<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE PatternGuards #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if !defined(TESTING) &amp;&amp; defined(__GLASGOW_HASKELL__)
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 708
</span><span class="hs-pragma">{-# LANGUAGE RoleAnnotations #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span class="hs-cpp">

#include &quot;containers.h&quot;
</span><span>
</span><span id="line-19"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- Module      :  Data.Set.Internal</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- Copyright   :  (c) Daan Leijen 2002</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- License     :  BSD-style</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-26"></span><span class="hs-comment">--</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- = WARNING</span><span>
</span><span id="line-28"></span><span class="hs-comment">--</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- This module is considered __internal__.</span><span>
</span><span id="line-30"></span><span class="hs-comment">--</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- The Package Versioning Policy __does not apply__.</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- The contents of this module may change __in any way whatsoever__</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- and __without any warning__ between minor versions of this package.</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- Authors importing this module are expected to track development</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- closely.</span><span>
</span><span id="line-38"></span><span class="hs-comment">--</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- = Description</span><span>
</span><span id="line-40"></span><span class="hs-comment">--</span><span>
</span><span id="line-41"></span><span class="hs-comment">-- An efficient implementation of sets.</span><span>
</span><span id="line-42"></span><span class="hs-comment">--</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- These modules are intended to be imported qualified, to avoid name</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- clashes with Prelude functions, e.g.</span><span>
</span><span id="line-45"></span><span class="hs-comment">--</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- &gt;  import Data.Set (Set)</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- &gt;  import qualified Data.Set as Set</span><span>
</span><span id="line-48"></span><span class="hs-comment">--</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- The implementation of 'Set' is based on /size balanced/ binary trees (or</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- trees of /bounded balance/) as described by:</span><span>
</span><span id="line-51"></span><span class="hs-comment">--</span><span>
</span><span id="line-52"></span><span class="hs-comment">--    * Stephen Adams, \&quot;/Efficient sets: a balancing act/\&quot;,</span><span>
</span><span id="line-53"></span><span class="hs-comment">--      Journal of Functional Programming 3(4):553-562, October 1993,</span><span>
</span><span id="line-54"></span><span class="hs-comment">--      &lt;http://www.swiss.ai.mit.edu/~adams/BB/&gt;.</span><span>
</span><span id="line-55"></span><span class="hs-comment">--    * J. Nievergelt and E.M. Reingold,</span><span>
</span><span id="line-56"></span><span class="hs-comment">--      \&quot;/Binary search trees of bounded balance/\&quot;,</span><span>
</span><span id="line-57"></span><span class="hs-comment">--      SIAM journal of computing 2(1), March 1973.</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span class="hs-comment">--  Bounds for 'union', 'intersection', and 'difference' are as given</span><span>
</span><span id="line-60"></span><span class="hs-comment">--  by</span><span>
</span><span id="line-61"></span><span class="hs-comment">--</span><span>
</span><span id="line-62"></span><span class="hs-comment">--    * Guy Blelloch, Daniel Ferizovic, and Yihan Sun,</span><span>
</span><span id="line-63"></span><span class="hs-comment">--      \&quot;/Just Join for Parallel Ordered Sets/\&quot;,</span><span>
</span><span id="line-64"></span><span class="hs-comment">--      &lt;https://arxiv.org/abs/1602.02120v3&gt;.</span><span>
</span><span id="line-65"></span><span class="hs-comment">--</span><span>
</span><span id="line-66"></span><span class="hs-comment">-- Note that the implementation is /left-biased/ -- the elements of a</span><span>
</span><span id="line-67"></span><span class="hs-comment">-- first argument are always preferred to the second, for example in</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- 'union' or 'insert'.  Of course, left-biasing can only be observed</span><span>
</span><span id="line-69"></span><span class="hs-comment">-- when equality is an equivalence relation instead of structural</span><span>
</span><span id="line-70"></span><span class="hs-comment">-- equality.</span><span>
</span><span id="line-71"></span><span class="hs-comment">--</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- /Warning/: The size of the set must not exceed @maxBound::Int@. Violation of</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- this condition is not detected and if the size limit is exceeded, the</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- behavior of the set is completely undefined.</span><span>
</span><span id="line-75"></span><span class="hs-comment">--</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- @since 0.5.9</span><span>
</span><span id="line-77"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-comment">-- [Note: Using INLINABLE]</span><span>
</span><span id="line-80"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-81"></span><span class="hs-comment">-- It is crucial to the performance that the functions specialize on the Ord</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- type when possible. GHC 7.0 and higher does this by itself when it sees th</span><span>
</span><span id="line-83"></span><span class="hs-comment">-- unfolding of a function -- that is why all public functions are marked</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- INLINABLE (that exposes the unfolding).</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-comment">-- [Note: Using INLINE]</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- For other compilers and GHC pre 7.0, we mark some of the functions INLINE.</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- We mark the functions that just navigate down the tree (lookup, insert,</span><span>
</span><span id="line-91"></span><span class="hs-comment">-- delete and similar). That navigation code gets inlined and thus specialized</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- when possible. There is a price to pay -- code growth. The code INLINED is</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- therefore only the tree navigation, all the real work (rebalancing) is not</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- INLINED by using a NOINLINE.</span><span>
</span><span id="line-95"></span><span class="hs-comment">--</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- All methods marked INLINE have to be nonrecursive -- a 'go' function doing</span><span>
</span><span id="line-97"></span><span class="hs-comment">-- the real work is provided.</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="hs-comment">-- [Note: Type of local 'go' function]</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- If the local 'go' function uses an Ord class, it sometimes heap-allocates</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- the Ord dictionary when the 'go' function does not have explicit type.</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- In that case we give 'go' explicit type. But this slightly decrease</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- performance, as the resulting 'go' function can float out to top level.</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- [Note: Local 'go' functions and capturing]</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- As opposed to IntSet, when 'go' function captures an argument, increased</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- heap-allocation can occur: sometimes in a polymorphic function, the 'go'</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- floats out of its enclosing function and then it heap-allocates the</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- dictionary and the argument. Maybe it floats out too late and strictness</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- analyzer cannot see that these could be passed on stack.</span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="hs-comment">-- [Note: Order of constructors]</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- The order of constructors of Set matters when considering performance.</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- Currently in GHC 7.0, when type has 2 constructors, a forward conditional</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- jump is made when successfully matching second constructor. Successful match</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- of first constructor results in the forward jump not taken.</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- On GHC 7.0, reordering constructors from Tip | Bin to Bin | Tip</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- improves the benchmark by up to 10% on x86.</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Set.Internal</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-126"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Set type</span></span><span>
</span><span id="line-127"></span><span>              </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier">Set</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>       </span><span class="hs-comment">-- instance Eq,Ord,Show,Read,Data,Typeable</span><span>
</span><span id="line-128"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Size"><span class="hs-identifier">Size</span></a></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Operators</span></span><span>
</span><span id="line-131"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Query</span></span><span>
</span><span id="line-134"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-135"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-136"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#member"><span class="hs-identifier">member</span></a></span><span>
</span><span id="line-137"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#notMember"><span class="hs-identifier">notMember</span></a></span><span>
</span><span id="line-138"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupLT"><span class="hs-identifier">lookupLT</span></a></span><span>
</span><span id="line-139"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupGT"><span class="hs-identifier">lookupGT</span></a></span><span>
</span><span id="line-140"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupLE"><span class="hs-identifier">lookupLE</span></a></span><span>
</span><span id="line-141"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupGE"><span class="hs-identifier">lookupGE</span></a></span><span>
</span><span id="line-142"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOf"><span class="hs-identifier">isSubsetOf</span></a></span><span>
</span><span id="line-143"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#isProperSubsetOf"><span class="hs-identifier">isProperSubsetOf</span></a></span><span>
</span><span id="line-144"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier">disjoint</span></a></span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Construction</span></span><span>
</span><span id="line-147"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-148"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier">singleton</span></a></span><span>
</span><span id="line-149"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#insert"><span class="hs-identifier">insert</span></a></span><span>
</span><span id="line-150"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#delete"><span class="hs-identifier">delete</span></a></span><span>
</span><span id="line-151"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#alterF"><span class="hs-identifier">alterF</span></a></span><span>
</span><span id="line-152"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#powerSet"><span class="hs-identifier">powerSet</span></a></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Combine</span></span><span>
</span><span id="line-155"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-156"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#unions"><span class="hs-identifier">unions</span></a></span><span>
</span><span id="line-157"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#difference"><span class="hs-identifier">difference</span></a></span><span>
</span><span id="line-158"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier">intersection</span></a></span><span>
</span><span id="line-159"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#cartesianProduct"><span class="hs-identifier">cartesianProduct</span></a></span><span>
</span><span id="line-160"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#disjointUnion"><span class="hs-identifier">disjointUnion</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Filter</span></span><span>
</span><span id="line-163"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-164"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier">takeWhileAntitone</span></a></span><span>
</span><span id="line-165"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier">dropWhileAntitone</span></a></span><span>
</span><span id="line-166"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#spanAntitone"><span class="hs-identifier">spanAntitone</span></a></span><span>
</span><span id="line-167"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-168"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-169"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier">splitMember</span></a></span><span>
</span><span id="line-170"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitRoot"><span class="hs-identifier">splitRoot</span></a></span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Indexed</span></span><span>
</span><span id="line-173"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupIndex"><span class="hs-identifier">lookupIndex</span></a></span><span>
</span><span id="line-174"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span>
</span><span id="line-175"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier">elemAt</span></a></span><span>
</span><span id="line-176"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#deleteAt"><span class="hs-identifier">deleteAt</span></a></span><span>
</span><span id="line-177"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#take"><span class="hs-identifier">take</span></a></span><span>
</span><span id="line-178"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#drop"><span class="hs-identifier">drop</span></a></span><span>
</span><span id="line-179"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Map</span></span><span>
</span><span id="line-182"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#map"><span class="hs-identifier">map</span></a></span><span>
</span><span id="line-183"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier">mapMonotonic</span></a></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Folds</span></span><span>
</span><span id="line-186"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-187"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-188"></span><span>            </span><span class="annot"><span class="hs-comment">-- ** Strict folds</span></span><span>
</span><span id="line-189"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span>
</span><span id="line-190"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-191"></span><span>            </span><span class="annot"><span class="hs-comment">-- ** Legacy folds</span></span><span>
</span><span id="line-192"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fold"><span class="hs-identifier">fold</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Min\/Max</span></span><span>
</span><span id="line-195"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupMin"><span class="hs-identifier">lookupMin</span></a></span><span>
</span><span id="line-196"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupMax"><span class="hs-identifier">lookupMax</span></a></span><span>
</span><span id="line-197"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#findMin"><span class="hs-identifier">findMin</span></a></span><span>
</span><span id="line-198"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#findMax"><span class="hs-identifier">findMax</span></a></span><span>
</span><span id="line-199"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier">deleteMin</span></a></span><span>
</span><span id="line-200"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier">deleteMax</span></a></span><span>
</span><span id="line-201"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#deleteFindMin"><span class="hs-identifier">deleteFindMin</span></a></span><span>
</span><span id="line-202"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#deleteFindMax"><span class="hs-identifier">deleteFindMax</span></a></span><span>
</span><span id="line-203"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#maxView"><span class="hs-identifier">maxView</span></a></span><span>
</span><span id="line-204"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#minView"><span class="hs-identifier">minView</span></a></span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Conversion</span></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span>            </span><span class="annot"><span class="hs-comment">-- ** List</span></span><span>
</span><span id="line-209"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#elems"><span class="hs-identifier">elems</span></a></span><span>
</span><span id="line-210"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toList"><span class="hs-identifier">toList</span></a></span><span>
</span><span id="line-211"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier">fromList</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span>            </span><span class="annot"><span class="hs-comment">-- ** Ordered list</span></span><span>
</span><span id="line-214"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier">toAscList</span></a></span><span>
</span><span id="line-215"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toDescList"><span class="hs-identifier">toDescList</span></a></span><span>
</span><span id="line-216"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromAscList"><span class="hs-identifier">fromAscList</span></a></span><span>
</span><span id="line-217"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromDistinctAscList"><span class="hs-identifier">fromDistinctAscList</span></a></span><span>
</span><span id="line-218"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromDescList"><span class="hs-identifier">fromDescList</span></a></span><span>
</span><span id="line-219"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromDistinctDescList"><span class="hs-identifier">fromDistinctDescList</span></a></span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>            </span><span class="annot"><span class="hs-comment">-- * Debugging</span></span><span>
</span><span id="line-222"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#showTree"><span class="hs-identifier">showTree</span></a></span><span>
</span><span id="line-223"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#showTreeWith"><span class="hs-identifier">showTreeWith</span></a></span><span>
</span><span id="line-224"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#valid"><span class="hs-identifier">valid</span></a></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span>            </span><span class="hs-comment">-- Internals (for testing)</span><span>
</span><span id="line-227"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#bin"><span class="hs-identifier">bin</span></a></span><span>
</span><span id="line-228"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier">balanced</span></a></span><span>
</span><span id="line-229"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#link"><span class="hs-identifier">link</span></a></span><span>
</span><span id="line-230"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#merge"><span class="hs-identifier">merge</span></a></span><span>
</span><span id="line-231"></span><span>            </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-identifier">Const</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">List</span></span><span>
</span><span id="line-236"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#"><span class="hs-identifier">Data.Bits</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-identifier">shiftL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-identifier">shiftR</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Monoid</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier">Semigroup</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#stimes"><span class="hs-identifier">stimes</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if !(MIN_VERSION_base(4,11,0)) &amp;&amp; MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Semigroup</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Semigroup</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator">&lt;&gt;</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Semigroup.Internal.html#stimesIdempotentMonoid"><span class="hs-identifier">stimesIdempotentMonoid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-248"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Classes.html#"><span class="hs-identifier">Data.Functor.Classes</span></a></span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier">Identity</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Foldable</span></span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Foldable</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Foldable</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">foldMap</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#"><span class="hs-identifier">Data.Typeable</span></a></span><span>
</span><span id="line-258"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#"><span class="hs-identifier">Control.DeepSeq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier">NFData</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier">rnf</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html"><span class="hs-identifier">Utils.Containers.Internal.StrictPair</span></a></span><span>
</span><span id="line-261"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.PtrEquality.html"><span class="hs-identifier">Utils.Containers.Internal.PtrEquality</span></a></span><span class="hs-cpp">

#if __GLASGOW_HASKELL__
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#build"><span class="hs-identifier">build</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">lazy</span></span><span> </span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 708
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">GHCExts</span></span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Text.Read.html#"><span class="hs-identifier">Text.Read</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#readPrec"><span class="hs-identifier">readPrec</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier">Read</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Text.Read.Lex.html#Lexeme"><span class="hs-identifier">Lexeme</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#parens"><span class="hs-identifier">parens</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Text.ParserCombinators.ReadPrec.html#prec"><span class="hs-identifier">prec</span></a></span><span>
</span><span id="line-269"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#lexP"><span class="hs-identifier">lexP</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#readListPrecDefault"><span class="hs-identifier">readListPrecDefault</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#"><span class="hs-identifier">Data.Data</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">{--------------------------------------------------------------------
  Operators
--------------------------------------------------------------------}</span><span>
</span><span id="line-277"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">9</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#%5C%5C"><span class="hs-operator hs-type">\\</span></a></span><span> </span><span class="hs-comment">--</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">-- | /O(m*log(n\/m+1)), m &lt;= n/. See 'difference'.</span><span>
</span><span id="line-280"></span><span id="local-6989586621679160683"><span class="annot"><a href="Data.Set.Internal.html#%5C%5C"><span class="hs-operator hs-type">(\\)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160683"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160683"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160683"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160683"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-281"></span><span id="local-6989586621679160141"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160141"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="%5C%5C"><span class="annot"><span class="annottext">\\ :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#%5C%5C"><span class="hs-operator hs-var hs-var">\\</span></a></span></span><span> </span><span id="local-6989586621679160140"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160140"><span class="hs-identifier hs-var">m2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var">difference</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160141"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160140"><span class="hs-identifier hs-var">m2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\\</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-286"></span><span class="hs-comment">{--------------------------------------------------------------------
  Sets are size balanced trees
--------------------------------------------------------------------}</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- | A set of values @a@.</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="hs-comment">-- See Note: Order of constructors</span><span>
</span><span id="line-292"></span><span class="hs-keyword">data</span><span> </span><span id="Set"><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-var">Set</span></a></span></span><span> </span><span id="local-6989586621679160553"><span class="annot"><a href="#local-6989586621679160553"><span class="hs-identifier hs-type">a</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="Bin"><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span></span><span> </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="Data.Set.Internal.html#Size"><span class="hs-identifier hs-type">Size</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621679160553"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160553"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160553"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span id="Tip"><span class="annot"><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span></span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span class="hs-keyword">type</span><span> </span><span id="Size"><span class="annot"><a href="Data.Set.Internal.html#Size"><span class="hs-identifier hs-var">Size</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-cpp">

#if __GLASGOW_HASKELL__ &gt;= 708
</span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">role</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><span class="hs-identifier">nominal</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-301"></span><span id="local-6989586621679160679"><span class="hs-keyword">instance</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160679"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160679"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-302"></span><span>    </span><span id="local-6989586621679160129"><span class="annot"><span class="annottext">mempty :: Set a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-303"></span><span>    </span><span id="local-6989586621679160126"><span class="annot"><span class="annottext">mconcat :: [Set a] -&gt; Set a
</span><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-identifier hs-var hs-var hs-var hs-var">mconcat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Set a] -&gt; Set a
forall (f :: * -&gt; *) a. (Foldable f, Ord a) =&gt; f (Set a) -&gt; Set a
</span><a href="Data.Set.Internal.html#unions"><span class="hs-identifier hs-var">unions</span></a></span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,9,0))
</span><span>    </span><span class="hs-identifier">mappend</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">union</span><span class="hs-cpp">
#else
</span><span>    </span><span id="local-6989586621679160124"><span class="annot"><span class="annottext">mappend :: Set a -&gt; Set a -&gt; Set a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(&lt;&gt;)</span></a></span></span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span class="hs-comment">-- | @since 0.5.7</span><span>
</span><span id="line-310"></span><span id="local-6989586621679160123"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679160120"><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160123"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160123"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-311"></span><span>    </span><span id="local-6989586621679160116"><span class="annot"><span class="annottext">&lt;&gt; :: Set a -&gt; Set a -&gt; Set a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;&gt;)</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span>
</span><span id="line-312"></span><span>    </span><span id="local-6989586621679160112"><span class="annot"><span class="annottext">stimes :: forall b. Integral b =&gt; b -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679160112"><span class="hs-identifier hs-var hs-var hs-var hs-var">stimes</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; Set a
forall b a. (Integral b, Monoid a) =&gt; b -&gt; a -&gt; a
</span><a href="../../base/src/Data.Semigroup.Internal.html#stimesIdempotentMonoid"><span class="hs-identifier hs-var">stimesIdempotentMonoid</span></a></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span class="hs-comment">-- | Folds in order of increasing key.</span><span>
</span><span id="line-317"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679160100"><span id="local-6989586621679160102"><span id="local-6989586621679160108"><span class="annot"><a href="../../base/src/Data.Foldable.html#Foldable"><span class="hs-identifier hs-type">Foldable.Foldable</span></a></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-318"></span><span>    </span><span id="local-6989586621679160088"><span class="annot"><span class="annottext">fold :: forall m. Monoid m =&gt; Set m -&gt; m
</span><a href="../../base/src/Data.Foldable.html#fold"><span class="hs-identifier hs-var hs-var hs-var hs-var">fold</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set m -&gt; m
forall m. Monoid m =&gt; Set m -&gt; m
</span><a href="#local-6989586621679160086"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-319"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679160086"><span class="annot"><span class="annottext">go :: Set a -&gt; a
</span><a href="#local-6989586621679160086"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-320"></span><span>            </span><span class="annot"><a href="#local-6989586621679160086"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679160077"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160077"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160077"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-321"></span><span>            </span><span class="annot"><a href="#local-6989586621679160086"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679160076"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160076"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679160075"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160075"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679160074"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160074"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; a
</span><a href="#local-6989586621679160086"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160075"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160076"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; a
</span><a href="#local-6989586621679160086"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160074"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>    </span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#fold"><span class="hs-pragma hs-type">fold</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-323"></span><span>    </span><span id="local-6989586621679160073"><span class="annot"><span class="annottext">foldr :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679160073"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span>
</span><span id="line-324"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-325"></span><span>    </span><span id="local-6989586621679160072"><span class="annot"><span class="annottext">foldl :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679160072"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span>
</span><span id="line-326"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-327"></span><span>    </span><span id="local-6989586621679160065"><span class="annot"><span class="annottext">foldMap :: forall m a. Monoid m =&gt; (a -&gt; m) -&gt; Set a -&gt; m
</span><a href="../../base/src/Data.Foldable.html#foldMap"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldMap</span></a></span></span><span> </span><span id="local-6989586621679160063"><span class="annot"><span class="annottext">a -&gt; m
</span><a href="#local-6989586621679160063"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679160062"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160062"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; m
</span><a href="#local-6989586621679160061"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160062"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-328"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679160061"><span class="annot"><span class="annottext">go :: Set a -&gt; m
</span><a href="#local-6989586621679160061"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-329"></span><span>            </span><span class="annot"><a href="#local-6989586621679160061"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679160060"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160060"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; m
</span><a href="#local-6989586621679160063"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160060"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-330"></span><span>            </span><span class="annot"><a href="#local-6989586621679160061"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679160059"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160059"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679160058"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160058"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679160057"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160057"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; m
</span><a href="#local-6989586621679160061"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160058"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">m -&gt; m -&gt; m
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; m
</span><a href="#local-6989586621679160063"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679160059"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">m -&gt; m -&gt; m
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; m
</span><a href="#local-6989586621679160061"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679160057"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldMap"><span class="hs-pragma hs-type">foldMap</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-332"></span><span>    </span><span id="local-6989586621679160056"><span class="annot"><span class="annottext">foldl' :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldl'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span>
</span><span id="line-333"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-334"></span><span>    </span><span id="local-6989586621679160054"><span class="annot"><span class="annottext">foldr' :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr%27"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldr'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr%27"><span class="hs-identifier hs-var">foldr'</span></a></span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr%27"><span class="hs-pragma hs-type">foldr'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#if MIN_VERSION_base(4,8,0)
</span><span>    </span><span id="local-6989586621679160052"><span class="annot"><span class="annottext">length :: forall a. Set a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var hs-var hs-var hs-var">length</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-338"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-339"></span><span>    </span><span id="local-6989586621679160050"><span class="annot"><span class="annottext">null :: forall a. Set a -&gt; Bool
</span><a href="#local-6989586621679160050"><span class="hs-identifier hs-var hs-var hs-var hs-var">null</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#null"><span class="hs-identifier hs-var">null</span></a></span><span>
</span><span id="line-340"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-341"></span><span>    </span><span id="local-6989586621679160049"><span class="annot"><span class="annottext">toList :: forall a. Set a -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#toList"><span class="hs-identifier hs-var hs-var hs-var hs-var">toList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span>
</span><span id="line-342"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#toList"><span class="hs-pragma hs-type">toList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-343"></span><span>    </span><span id="local-6989586621679160045"><span class="annot"><span class="annottext">elem :: forall a. Eq a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-identifier hs-var hs-var hs-var hs-var">elem</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Eq a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679160043"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-344"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679160043"><span class="annot"><span class="annottext">go :: t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679160043"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-345"></span><span>            </span><span class="annot"><a href="#local-6989586621679160043"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679160040"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160040"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679160039"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160039"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679160038"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679160038"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679160037"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679160037"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160040"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160039"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679160043"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160040"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679160038"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679160043"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679160040"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679160037"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-346"></span><span>    </span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-pragma hs-type">elem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-347"></span><span>    </span><span id="local-6989586621679160034"><span class="annot"><span class="annottext">minimum :: forall a. Ord a =&gt; Set a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#minimum"><span class="hs-identifier hs-var hs-var hs-var hs-var">minimum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; a
forall a. Set a -&gt; a
</span><a href="Data.Set.Internal.html#findMin"><span class="hs-identifier hs-var">findMin</span></a></span><span>
</span><span id="line-348"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-349"></span><span>    </span><span id="local-6989586621679160031"><span class="annot"><span class="annottext">maximum :: forall a. Ord a =&gt; Set a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#maximum"><span class="hs-identifier hs-var hs-var hs-var hs-var">maximum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; a
forall a. Set a -&gt; a
</span><a href="Data.Set.Internal.html#findMax"><span class="hs-identifier hs-var">findMax</span></a></span><span>
</span><span id="line-350"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-351"></span><span>    </span><span id="local-6989586621679160026"><span class="annot"><span class="annottext">sum :: forall a. Num a =&gt; Set a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#sum"><span class="hs-identifier hs-var hs-var hs-var hs-var">sum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; Set a -&gt; a
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">(+)</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#sum"><span class="hs-pragma hs-type">sum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-353"></span><span>    </span><span id="local-6989586621679160020"><span class="annot"><span class="annottext">product :: forall a. Num a =&gt; Set a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#product"><span class="hs-identifier hs-var hs-var hs-var hs-var">product</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; Set a -&gt; a
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">(*)</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#product"><span class="hs-pragma hs-type">product</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">

#if __GLASGOW_HASKELL__
</span><span>
</span><span id="line-360"></span><span class="hs-comment">{--------------------------------------------------------------------
  A Data instance
--------------------------------------------------------------------}</span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span class="hs-comment">-- This instance preserves data abstraction at the cost of inefficiency.</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- We provide limited reflection services for the sake of data abstraction.</span><span>
</span><span id="line-366"></span><span>
</span><span id="line-367"></span><span id="local-6989586621679160597"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159992"><span id="local-6989586621679159994"><span id="local-6989586621679159996"><span id="local-6989586621679159998"><span id="local-6989586621679160000"><span id="local-6989586621679160002"><span id="local-6989586621679160004"><span id="local-6989586621679160006"><span id="local-6989586621679160008"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160597"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160597"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160597"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-368"></span><span>  </span><span id="local-6989586621679159987"><span class="annot"><span class="annottext">gfoldl :: forall (c :: * -&gt; *).
(forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b)
-&gt; (forall g. g -&gt; c g) -&gt; Set a -&gt; c (Set a)
</span><a href="../../base/src/Data.Data.html#gfoldl"><span class="hs-identifier hs-var hs-var hs-var hs-var">gfoldl</span></a></span></span><span> </span><span id="local-6989586621679159985"><span class="annot"><span class="annottext">forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679159985"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159984"><span class="annot"><span class="annottext">forall g. g -&gt; c g
</span><a href="#local-6989586621679159984"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679159983"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159983"><span class="hs-identifier hs-var">set</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Set a) -&gt; c ([a] -&gt; Set a)
forall g. g -&gt; c g
</span><a href="#local-6989586621679159984"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="annot"><span class="annottext">c ([a] -&gt; Set a) -&gt; [a] -&gt; c (Set a)
forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679159985"><span class="hs-operator hs-var">`f`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159983"><span class="hs-identifier hs-var">set</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-369"></span><span>  </span><span id="local-6989586621679159982"><span class="annot"><span class="annottext">toConstr :: Set a -&gt; Constr
</span><a href="../../base/src/Data.Data.html#toConstr"><span class="hs-identifier hs-var hs-var hs-var hs-var">toConstr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Constr
</span><a href="Data.Set.Internal.html#fromListConstr"><span class="hs-identifier hs-var">fromListConstr</span></a></span><span>
</span><span id="line-370"></span><span>  </span><span id="local-6989586621679159973"><span class="annot"><span class="annottext">gunfold :: forall (c :: * -&gt; *).
(forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r)
-&gt; (forall r. r -&gt; c r) -&gt; Constr -&gt; c (Set a)
</span><a href="../../base/src/Data.Data.html#gunfold"><span class="hs-identifier hs-var hs-var hs-var hs-var">gunfold</span></a></span></span><span> </span><span id="local-6989586621679159971"><span class="annot"><span class="annottext">forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><a href="#local-6989586621679159971"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679159970"><span class="annot"><span class="annottext">forall r. r -&gt; c r
</span><a href="#local-6989586621679159970"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679159969"><span class="annot"><span class="annottext">Constr
</span><a href="#local-6989586621679159969"><span class="hs-identifier hs-var">c</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Constr -&gt; Int
</span><a href="../../base/src/Data.Data.html#constrIndex"><span class="hs-identifier hs-var">constrIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Constr
</span><a href="#local-6989586621679159969"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-371"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">c ([a] -&gt; Set a) -&gt; c (Set a)
forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><a href="#local-6989586621679159971"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([a] -&gt; Set a) -&gt; c ([a] -&gt; Set a)
forall r. r -&gt; c r
</span><a href="#local-6989586621679159970"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; c (Set a)
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;gunfold&quot;</span></span><span>
</span><span id="line-373"></span><span>  </span><span id="local-6989586621679159966"><span class="annot"><span class="annottext">dataTypeOf :: Set a -&gt; DataType
</span><a href="../../base/src/Data.Data.html#dataTypeOf"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataTypeOf</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="Data.Set.Internal.html#setDataType"><span class="hs-identifier hs-var">setDataType</span></a></span><span>
</span><span id="line-374"></span><span>  </span><span id="local-6989586621679159959"><span class="annot"><span class="annottext">dataCast1 :: forall (t :: * -&gt; *) (c :: * -&gt; *).
Typeable t =&gt;
(forall d. Data d =&gt; c (t d)) -&gt; Maybe (c (Set a))
</span><a href="../../base/src/Data.Data.html#dataCast1"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataCast1</span></a></span></span><span> </span><span id="local-6989586621679159957"><span class="annot"><span class="annottext">forall d. Data d =&gt; c (t d)
</span><a href="#local-6989586621679159957"><span class="hs-identifier hs-var">f</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">c (t a) -&gt; Maybe (c (Set a))
forall {k1} {k2} (c :: k1 -&gt; *) (t :: k2 -&gt; k1) (t' :: k2 -&gt; k1)
       (a :: k2).
(Typeable t, Typeable t') =&gt;
c (t a) -&gt; Maybe (c (t' a))
</span><a href="../../base/src/Data.Typeable.html#gcast1"><span class="hs-identifier hs-var">gcast1</span></a></span><span> </span><span class="annot"><span class="annottext">c (t a)
forall d. Data d =&gt; c (t d)
</span><a href="#local-6989586621679159957"><span class="hs-identifier hs-var">f</span></a></span></span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span class="annot"><a href="Data.Set.Internal.html#fromListConstr"><span class="hs-identifier hs-type">fromListConstr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Constr"><span class="hs-identifier hs-type">Constr</span></a></span><span>
</span><span id="line-377"></span><span id="fromListConstr"><span class="annot"><span class="annottext">fromListConstr :: Constr
</span><a href="Data.Set.Internal.html#fromListConstr"><span class="hs-identifier hs-var hs-var">fromListConstr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType -&gt; [Char] -&gt; [[Char]] -&gt; Fixity -&gt; Constr
</span><a href="../../base/src/Data.Data.html#mkConstr"><span class="hs-identifier hs-var">mkConstr</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="Data.Set.Internal.html#setDataType"><span class="hs-identifier hs-var">setDataType</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;fromList&quot;</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="../../base/src/Data.Data.html#Prefix"><span class="hs-identifier hs-var">Prefix</span></a></span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="annot"><a href="Data.Set.Internal.html#setDataType"><span class="hs-identifier hs-type">setDataType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#DataType"><span class="hs-identifier hs-type">DataType</span></a></span><span>
</span><span id="line-380"></span><span id="setDataType"><span class="annot"><span class="annottext">setDataType :: DataType
</span><a href="Data.Set.Internal.html#setDataType"><span class="hs-identifier hs-var hs-var">setDataType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Constr] -&gt; DataType
</span><a href="../../base/src/Data.Data.html#mkDataType"><span class="hs-identifier hs-var">mkDataType</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Data.Set.Internal.Set&quot;</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Constr
</span><a href="Data.Set.Internal.html#fromListConstr"><span class="hs-identifier hs-var">fromListConstr</span></a></span><span class="hs-special">]</span><span class="hs-cpp">

#endif
</span><span>
</span><span id="line-384"></span><span class="hs-comment">{--------------------------------------------------------------------
  Query
--------------------------------------------------------------------}</span><span>
</span><span id="line-387"></span><span class="hs-comment">-- | /O(1)/. Is this the empty set?</span><span>
</span><span id="line-388"></span><span id="local-6989586621679159952"><span class="annot"><a href="Data.Set.Internal.html#null"><span class="hs-identifier hs-type">null</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159952"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-389"></span><span id="null"><span class="annot"><span class="annottext">null :: forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#null"><span class="hs-identifier hs-var hs-var">null</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-390"></span><span class="annot"><a href="Data.Set.Internal.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-391"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span class="hs-comment">-- | /O(1)/. The number of elements in the set.</span><span>
</span><span id="line-394"></span><span id="local-6989586621679159951"><span class="annot"><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-type">size</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159951"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-395"></span><span id="size"><span class="annot"><span class="annottext">size :: forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var hs-var">size</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-396"></span><span class="annot"><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159950"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159950"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159950"><span class="hs-identifier hs-var">sz</span></a></span><span>
</span><span id="line-397"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#size"><span class="hs-pragma hs-type">size</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span class="hs-comment">-- | /O(log n)/. Is the element in the set?</span><span>
</span><span id="line-400"></span><span id="local-6989586621679160577"><span class="annot"><a href="Data.Set.Internal.html#member"><span class="hs-identifier hs-type">member</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160577"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160577"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160577"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-401"></span><span id="member"><span class="annot"><span class="annottext">member :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#member"><span class="hs-identifier hs-var hs-var">member</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679159947"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-402"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-403"></span><span>    </span><span id="local-6989586621679159947"><span class="annot"><span class="annottext">go :: t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679159947"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-404"></span><span>    </span><span class="annot"><a href="#local-6989586621679159947"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159944"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159944"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159943"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159943"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159942"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159942"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159941"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159941"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159944"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159943"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-405"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679159947"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159944"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159942"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-406"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Bool
</span><a href="#local-6989586621679159947"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159944"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159941"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-407"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#member"><span class="hs-pragma hs-type">member</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">member</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-414"></span><span class="hs-comment">-- | /O(log n)/. Is the element not in the set?</span><span>
</span><span id="line-415"></span><span id="local-6989586621679159939"><span class="annot"><a href="Data.Set.Internal.html#notMember"><span class="hs-identifier hs-type">notMember</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159939"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159939"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159939"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-416"></span><span id="notMember"><span class="annot"><span class="annottext">notMember :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#notMember"><span class="hs-identifier hs-var hs-var">notMember</span></a></span></span><span> </span><span id="local-6989586621679159936"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159936"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679159935"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159935"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#member"><span class="hs-identifier hs-var">member</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159936"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159935"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#notMember"><span class="hs-pragma hs-type">notMember</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">notMember</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- | /O(log n)/. Find largest element smaller than the given one.</span><span>
</span><span id="line-424"></span><span class="hs-comment">--</span><span>
</span><span id="line-425"></span><span class="hs-comment">-- &gt; lookupLT 3 (fromList [3, 5]) == Nothing</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- &gt; lookupLT 5 (fromList [3, 5]) == Just 3</span><span>
</span><span id="line-427"></span><span id="local-6989586621679160569"><span class="annot"><a href="Data.Set.Internal.html#lookupLT"><span class="hs-identifier hs-type">lookupLT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160569"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160569"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160569"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160569"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-428"></span><span id="lookupLT"><span class="annot"><span class="annottext">lookupLT :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupLT"><span class="hs-identifier hs-var hs-var">lookupLT</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Maybe a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159931"><span class="hs-identifier hs-var">goNothing</span></a></span><span>
</span><span id="line-429"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-430"></span><span>    </span><span id="local-6989586621679159931"><span class="annot"><span class="annottext">goNothing :: a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159931"><span class="hs-identifier hs-var hs-var">goNothing</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-431"></span><span>    </span><span class="annot"><a href="#local-6989586621679159931"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span id="local-6989586621679159927"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159927"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159926"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159926"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159925"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159925"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159924"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159924"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159927"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159926"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159931"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159927"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159925"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-432"></span><span>                              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Maybe a
forall {t}. Ord t =&gt; t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159922"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159927"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159926"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159924"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span>    </span><span id="local-6989586621679159922"><span class="annot"><span class="annottext">goJust :: t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159922"><span class="hs-identifier hs-var hs-var">goJust</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159919"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159919"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159919"><span class="hs-identifier hs-var">best</span></a></span><span>
</span><span id="line-435"></span><span>    </span><span class="annot"><a href="#local-6989586621679159922"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span id="local-6989586621679159918"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159918"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159917"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159917"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159916"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159916"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159915"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159915"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159914"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159914"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159918"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159916"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159922"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159918"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159917"><span class="hs-identifier hs-var">best</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159915"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-436"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159922"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159918"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159916"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159914"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupLT"><span class="hs-pragma hs-type">lookupLT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">lookupLT</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-443"></span><span class="hs-comment">-- | /O(log n)/. Find smallest element greater than the given one.</span><span>
</span><span id="line-444"></span><span class="hs-comment">--</span><span>
</span><span id="line-445"></span><span class="hs-comment">-- &gt; lookupGT 4 (fromList [3, 5]) == Just 5</span><span>
</span><span id="line-446"></span><span class="hs-comment">-- &gt; lookupGT 5 (fromList [3, 5]) == Nothing</span><span>
</span><span id="line-447"></span><span id="local-6989586621679159913"><span class="annot"><a href="Data.Set.Internal.html#lookupGT"><span class="hs-identifier hs-type">lookupGT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159913"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159913"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159913"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159913"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-448"></span><span id="lookupGT"><span class="annot"><span class="annottext">lookupGT :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupGT"><span class="hs-identifier hs-var hs-var">lookupGT</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Maybe a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159910"><span class="hs-identifier hs-var">goNothing</span></a></span><span>
</span><span id="line-449"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-450"></span><span>    </span><span id="local-6989586621679159910"><span class="annot"><span class="annottext">goNothing :: t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159910"><span class="hs-identifier hs-var hs-var">goNothing</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe t
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-451"></span><span>    </span><span class="annot"><a href="#local-6989586621679159910"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span id="local-6989586621679159906"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159906"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159905"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159905"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159904"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159904"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159903"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159903"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159906"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159905"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
forall {t}. Ord t =&gt; t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159901"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159906"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159905"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159904"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-452"></span><span>                              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159910"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159906"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159903"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span>    </span><span id="local-6989586621679159901"><span class="annot"><span class="annottext">goJust :: t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159901"><span class="hs-identifier hs-var hs-var">goJust</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159898"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159898"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159898"><span class="hs-identifier hs-var">best</span></a></span><span>
</span><span id="line-455"></span><span>    </span><span class="annot"><a href="#local-6989586621679159901"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span id="local-6989586621679159897"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159897"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159896"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159896"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159895"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159895"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159894"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159894"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159893"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159893"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159897"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159895"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159901"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159897"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159895"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159894"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-456"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159901"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159897"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159896"><span class="hs-identifier hs-var">best</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159893"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupGT"><span class="hs-pragma hs-type">lookupGT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">lookupGT</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- | /O(log n)/. Find largest element smaller or equal to the given one.</span><span>
</span><span id="line-464"></span><span class="hs-comment">--</span><span>
</span><span id="line-465"></span><span class="hs-comment">-- &gt; lookupLE 2 (fromList [3, 5]) == Nothing</span><span>
</span><span id="line-466"></span><span class="hs-comment">-- &gt; lookupLE 4 (fromList [3, 5]) == Just 3</span><span>
</span><span id="line-467"></span><span class="hs-comment">-- &gt; lookupLE 5 (fromList [3, 5]) == Just 5</span><span>
</span><span id="line-468"></span><span id="local-6989586621679159892"><span class="annot"><a href="Data.Set.Internal.html#lookupLE"><span class="hs-identifier hs-type">lookupLE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159892"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159892"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159892"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159892"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-469"></span><span id="lookupLE"><span class="annot"><span class="annottext">lookupLE :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupLE"><span class="hs-identifier hs-var hs-var">lookupLE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Maybe a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159889"><span class="hs-identifier hs-var">goNothing</span></a></span><span>
</span><span id="line-470"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-471"></span><span>    </span><span id="local-6989586621679159889"><span class="annot"><span class="annottext">goNothing :: t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159889"><span class="hs-identifier hs-var hs-var">goNothing</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe t
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-472"></span><span>    </span><span class="annot"><a href="#local-6989586621679159889"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span id="local-6989586621679159885"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159885"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159884"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159884"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159883"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159883"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159882"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159882"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159885"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159884"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159889"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159885"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159883"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-473"></span><span>                                                    </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159884"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-474"></span><span>                                                    </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
forall {t}. Ord t =&gt; t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159881"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159885"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159884"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159882"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-475"></span><span>
</span><span id="line-476"></span><span>    </span><span id="local-6989586621679159881"><span class="annot"><span class="annottext">goJust :: t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159881"><span class="hs-identifier hs-var hs-var">goJust</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159878"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159878"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159878"><span class="hs-identifier hs-var">best</span></a></span><span>
</span><span id="line-477"></span><span>    </span><span class="annot"><a href="#local-6989586621679159881"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span id="local-6989586621679159877"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159877"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159876"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159876"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159875"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159875"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159874"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159874"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159873"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159873"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159877"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159875"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159881"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159877"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159876"><span class="hs-identifier hs-var">best</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159874"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-478"></span><span>                                                      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159875"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-479"></span><span>                                                      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159881"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159877"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159875"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159873"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupLE"><span class="hs-pragma hs-type">lookupLE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">lookupLE</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-486"></span><span class="hs-comment">-- | /O(log n)/. Find smallest element greater or equal to the given one.</span><span>
</span><span id="line-487"></span><span class="hs-comment">--</span><span>
</span><span id="line-488"></span><span class="hs-comment">-- &gt; lookupGE 3 (fromList [3, 5]) == Just 3</span><span>
</span><span id="line-489"></span><span class="hs-comment">-- &gt; lookupGE 4 (fromList [3, 5]) == Just 5</span><span>
</span><span id="line-490"></span><span class="hs-comment">-- &gt; lookupGE 6 (fromList [3, 5]) == Nothing</span><span>
</span><span id="line-491"></span><span id="local-6989586621679159872"><span class="annot"><a href="Data.Set.Internal.html#lookupGE"><span class="hs-identifier hs-type">lookupGE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159872"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-492"></span><span id="lookupGE"><span class="annot"><span class="annottext">lookupGE :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupGE"><span class="hs-identifier hs-var hs-var">lookupGE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Maybe a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159869"><span class="hs-identifier hs-var">goNothing</span></a></span><span>
</span><span id="line-493"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-494"></span><span>    </span><span id="local-6989586621679159869"><span class="annot"><span class="annottext">goNothing :: t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159869"><span class="hs-identifier hs-var hs-var">goNothing</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe t
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-495"></span><span>    </span><span class="annot"><a href="#local-6989586621679159869"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span id="local-6989586621679159865"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159865"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159864"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159864"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159863"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159863"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159862"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159862"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159865"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159864"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; Set t -&gt; Maybe t
forall {t}. Ord t =&gt; t -&gt; t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159861"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159865"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159864"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159863"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-496"></span><span>                                                    </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Maybe t
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159864"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-497"></span><span>                                                    </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Maybe t
</span><a href="#local-6989586621679159869"><span class="hs-identifier hs-var">goNothing</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159865"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679159862"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span>    </span><span id="local-6989586621679159861"><span class="annot"><span class="annottext">goJust :: a -&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159861"><span class="hs-identifier hs-var hs-var">goJust</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159858"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159858"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159858"><span class="hs-identifier hs-var">best</span></a></span><span>
</span><span id="line-500"></span><span>    </span><span class="annot"><a href="#local-6989586621679159861"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span id="local-6989586621679159857"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159857"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159856"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159856"><span class="hs-identifier hs-var">best</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159855"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159855"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159854"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159854"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159853"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159853"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159857"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159855"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159861"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159857"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159855"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159854"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-501"></span><span>                                                      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159855"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-502"></span><span>                                                      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Maybe a
</span><a href="#local-6989586621679159861"><span class="hs-identifier hs-var">goJust</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159857"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159856"><span class="hs-identifier hs-var">best</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159853"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupGE"><span class="hs-pragma hs-type">lookupGE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">lookupGE</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-509"></span><span class="hs-comment">{--------------------------------------------------------------------
  Construction
--------------------------------------------------------------------}</span><span>
</span><span id="line-512"></span><span class="hs-comment">-- | /O(1)/. The empty set.</span><span>
</span><span id="line-513"></span><span id="local-6989586621679160678"><span class="annot"><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-type">empty</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160678"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-514"></span><span id="empty"><span class="annot"><span class="annottext">empty :: forall a. Set a
</span><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-515"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-comment">-- | /O(1)/. Create a singleton set.</span><span>
</span><span id="line-518"></span><span id="local-6989586621679160555"><span class="annot"><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679160555"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160555"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-519"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621679159852"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159852"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159852"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-520"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-521"></span><span>
</span><span id="line-522"></span><span class="hs-comment">{--------------------------------------------------------------------
  Insertion, Deletion
--------------------------------------------------------------------}</span><span>
</span><span id="line-525"></span><span class="hs-comment">-- | /O(log n)/. Insert an element in a set.</span><span>
</span><span id="line-526"></span><span class="hs-comment">-- If the set already contains an element equal to the given value,</span><span>
</span><span id="line-527"></span><span class="hs-comment">-- it is replaced with the new value.</span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span class="hs-comment">-- See Note: Type of local 'go' function</span><span>
</span><span id="line-530"></span><span class="hs-comment">-- See Note: Avoiding worker/wrapper (in Data.Map.Internal)</span><span>
</span><span id="line-531"></span><span id="local-6989586621679160552"><span class="annot"><a href="Data.Set.Internal.html#insert"><span class="hs-identifier hs-type">insert</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160552"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160552"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160552"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160552"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-532"></span><span id="insert"><span class="annot"><span class="annottext">insert :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insert"><span class="hs-identifier hs-var hs-var">insert</span></a></span></span><span> </span><span id="local-6989586621679159849"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159849"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159848"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159849"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159849"><span class="hs-identifier hs-var">x0</span></a></span><span>
</span><span id="line-533"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-534"></span><span>    </span><span id="local-6989586621679160550"><span class="annot"><a href="#local-6989586621679159848"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160550"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160550"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160550"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160550"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160550"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-535"></span><span>    </span><span id="local-6989586621679159848"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159848"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159843"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159843"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">lazy</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159843"><span class="hs-identifier hs-var">orig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span>    </span><span class="annot"><a href="#local-6989586621679159848"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159842"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159841"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159841"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159840"><span class="annot"><span class="annottext">t :: Set a
</span><a href="#local-6989586621679159840"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159839"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159839"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span id="local-6989586621679159838"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159838"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159837"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159837"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159836"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159836"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159841"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159838"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-537"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159835"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159837"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159840"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-538"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159838"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159835"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159836"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-539"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159835"><span class="annot"><span class="annottext">l' :: Set a
</span><a href="#local-6989586621679159835"><span class="hs-identifier hs-var hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159848"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159841"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159837"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-540"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159832"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159836"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159840"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-541"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159838"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159837"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159832"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-542"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159832"><span class="annot"><span class="annottext">r' :: Set a
</span><a href="#local-6989586621679159832"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159848"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159841"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159836"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-543"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">lazy</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159838"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159840"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-544"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159839"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">lazy</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159842"><span class="hs-identifier hs-var">orig</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159837"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159836"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#insert"><span class="hs-pragma hs-type">insert</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insert</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#ifndef __GLASGOW_HASKELL__
</span><span class="hs-identifier">lazy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-553"></span><span class="hs-identifier">lazy</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">a</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-556"></span><span class="hs-comment">-- Insert an element to the set only if it is not in the set.</span><span>
</span><span id="line-557"></span><span class="hs-comment">-- Used by `union`.</span><span>
</span><span id="line-558"></span><span>
</span><span id="line-559"></span><span class="hs-comment">-- See Note: Type of local 'go' function</span><span>
</span><span id="line-560"></span><span class="hs-comment">-- See Note: Avoiding worker/wrapper (in Data.Map.Internal)</span><span>
</span><span id="line-561"></span><span id="local-6989586621679159830"><span class="annot"><a href="Data.Set.Internal.html#insertR"><span class="hs-identifier hs-type">insertR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159830"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159830"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159830"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159830"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-562"></span><span id="insertR"><span class="annot"><span class="annottext">insertR :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertR"><span class="hs-identifier hs-var hs-var">insertR</span></a></span></span><span> </span><span id="local-6989586621679159826"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159826"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159825"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159826"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159826"><span class="hs-identifier hs-var">x0</span></a></span><span>
</span><span id="line-563"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-564"></span><span>    </span><span id="local-6989586621679159824"><span class="annot"><a href="#local-6989586621679159825"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159824"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159824"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159824"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159824"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159824"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-565"></span><span>    </span><span id="local-6989586621679159825"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159825"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159819"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159819"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">lazy</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159819"><span class="hs-identifier hs-var">orig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>    </span><span class="annot"><a href="#local-6989586621679159825"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159818"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159818"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159817"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159817"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159816"><span class="annot"><span class="annottext">t :: Set a
</span><a href="#local-6989586621679159816"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159815"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159815"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159814"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159814"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159813"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159813"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159817"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159815"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-567"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159812"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159814"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159816"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-568"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159815"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159812"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159813"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-569"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159812"><span class="annot"><span class="annottext">l' :: Set a
</span><a href="#local-6989586621679159812"><span class="hs-identifier hs-var hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159825"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159818"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159817"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159814"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-570"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159811"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159813"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159816"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-571"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159815"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159814"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159811"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-572"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159811"><span class="annot"><span class="annottext">r' :: Set a
</span><a href="#local-6989586621679159811"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159825"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159818"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159817"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159813"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-573"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159816"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#insertR"><span class="hs-pragma hs-type">insertR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertR</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-580"></span><span class="hs-comment">-- | /O(log n)/. Delete an element from a set.</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span class="hs-comment">-- See Note: Type of local 'go' function</span><span>
</span><span id="line-583"></span><span id="local-6989586621679159810"><span class="annot"><a href="Data.Set.Internal.html#delete"><span class="hs-identifier hs-type">delete</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159810"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-584"></span><span id="delete"><span class="annot"><span class="annottext">delete :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#delete"><span class="hs-identifier hs-var hs-var">delete</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159807"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-585"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-586"></span><span>    </span><span id="local-6989586621679159806"><span class="annot"><a href="#local-6989586621679159807"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159806"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-587"></span><span>    </span><span id="local-6989586621679159807"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159807"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-588"></span><span>    </span><span class="annot"><a href="#local-6989586621679159807"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159801"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159801"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159800"><span class="annot"><span class="annottext">t :: Set a
</span><a href="#local-6989586621679159800"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159799"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159799"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159798"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159798"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159797"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159797"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159801"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159799"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-589"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159796"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159798"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159800"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-590"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159799"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159796"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159797"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-591"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159796"><span class="annot"><span class="annottext">l' :: Set a
</span><a href="#local-6989586621679159796"><span class="hs-identifier hs-var hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159807"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159801"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159798"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-592"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159795"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159797"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159800"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-593"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159799"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159798"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159795"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-594"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159795"><span class="annot"><span class="annottext">r' :: Set a
</span><a href="#local-6989586621679159795"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159807"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159801"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159797"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-595"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159798"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159797"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#delete"><span class="hs-pragma hs-type">delete</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">delete</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-602"></span><span class="hs-comment">-- | /O(log n)/ @('alterF' f x s)@ can delete or insert @x@ in @s@ depending on</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- whether an equal element is found in @s@.</span><span>
</span><span id="line-604"></span><span class="hs-comment">--</span><span>
</span><span id="line-605"></span><span class="hs-comment">-- In short:</span><span>
</span><span id="line-606"></span><span class="hs-comment">--</span><span>
</span><span id="line-607"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- 'member' x \&lt;$\&gt; 'alterF' f x s = f ('member' x s)</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-610"></span><span class="hs-comment">--</span><span>
</span><span id="line-611"></span><span class="hs-comment">-- Note that unlike 'insert', 'alterF' will /not/ replace an element equal to</span><span>
</span><span id="line-612"></span><span class="hs-comment">-- the given value.</span><span>
</span><span id="line-613"></span><span class="hs-comment">--</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- Note: 'alterF' is a variant of the @at@ combinator from &quot;Control.Lens.At&quot;.</span><span>
</span><span id="line-615"></span><span class="hs-comment">--</span><span>
</span><span id="line-616"></span><span class="hs-comment">-- @since 0.6.3.1</span><span>
</span><span id="line-617"></span><span id="local-6989586621679160538"><span id="local-6989586621679160539"><span class="annot"><a href="Data.Set.Internal.html#alterF"><span class="hs-identifier hs-type">alterF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160539"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160538"><span class="hs-identifier hs-type">f</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160538"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160539"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160539"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160538"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160539"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-618"></span><span id="alterF"><span class="annot"><span class="annottext">alterF :: forall a (f :: * -&gt; *).
(Ord a, Functor f) =&gt;
(Bool -&gt; f Bool) -&gt; a -&gt; Set a -&gt; f (Set a)
</span><a href="Data.Set.Internal.html#alterF"><span class="hs-identifier hs-var hs-var">alterF</span></a></span></span><span> </span><span id="local-6989586621679159789"><span class="annot"><span class="annottext">Bool -&gt; f Bool
</span><a href="#local-6989586621679159789"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159788"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159788"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679159787"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159787"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Set a) -&gt; f Bool -&gt; f (Set a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Set a
</span><a href="#local-6989586621679159786"><span class="hs-identifier hs-var">choose</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; f Bool
</span><a href="#local-6989586621679159789"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159785"><span class="hs-identifier hs-var">member_</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-619"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-620"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679159785"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159785"><span class="hs-identifier hs-var">member_</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159784"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159784"><span class="hs-identifier hs-var">inserted</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159783"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159783"><span class="hs-identifier hs-var">deleted</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; AlteredSet a
forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#alteredSet"><span class="hs-identifier hs-var">alteredSet</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159788"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159787"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-621"></span><span>        </span><span class="annot"><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-type">Deleted</span></a></span><span> </span><span id="local-6989586621679159780"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159780"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159787"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159780"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-622"></span><span>        </span><span class="annot"><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679159778"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159778"><span class="hs-identifier hs-var">i</span></a></span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159778"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159787"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span>    </span><span id="local-6989586621679159786"><span class="annot"><span class="annottext">choose :: Bool -&gt; Set a
</span><a href="#local-6989586621679159786"><span class="hs-identifier hs-var hs-var">choose</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159784"><span class="hs-identifier hs-var">inserted</span></a></span><span>
</span><span id="line-625"></span><span>    </span><span class="annot"><a href="#local-6989586621679159786"><span class="hs-identifier hs-var">choose</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159783"><span class="hs-identifier hs-var">deleted</span></a></span><span class="hs-cpp">
#ifndef __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">alterF</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">2</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-632"></span><span id="local-6989586621679159777"><span class="annot"><span class="hs-pragma">&quot;alterF/Const&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679159776"><span class="annot"><a href="#local-6989586621679159776"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679159775"><span class="annot"><a href="#local-6989586621679159775"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Bool</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-pragma hs-type">Const</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159777"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Bool</span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159775"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159776"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">\</span><span id="local-6989586621679159774"><span class="annot"><a href="#local-6989586621679159774"><span class="hs-pragma hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-pragma hs-type">Const</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#getConst"><span class="hs-pragma hs-var">getConst</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159775"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24"><span class="hs-pragma hs-type">$</span></a></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#member"><span class="hs-pragma hs-type">member</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159776"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159774"><span class="hs-pragma hs-type">s</span></a></span></span><span>
</span><span id="line-633"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,8,0)
</span><span id="local-6989586621679159770"><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><span class="hs-pragma hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159770"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">=&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma hs-type">Bool</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-pragma hs-type">Identity</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Bool</span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159770"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-pragma hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159770"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-pragma hs-type">Identity</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-pragma hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159770"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-640"></span><span class="hs-keyword">data</span><span> </span><span id="AlteredSet"><span class="annot"><a href="Data.Set.Internal.html#AlteredSet"><span class="hs-identifier hs-var">AlteredSet</span></a></span></span><span> </span><span id="local-6989586621679160528"><span class="annot"><a href="#local-6989586621679160528"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-641"></span><span>      </span><span class="hs-comment">-- | The needle is present in the original set.</span><span>
</span><span id="line-642"></span><span>      </span><span class="hs-comment">-- We return the set where the needle is deleted.</span><span>
</span><span id="line-643"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="Deleted"><span class="annot"><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-var">Deleted</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160528"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span>      </span><span class="hs-comment">-- | The needle is not present in the original set.</span><span>
</span><span id="line-646"></span><span>      </span><span class="hs-comment">-- We return the set with the needle inserted.</span><span>
</span><span id="line-647"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span id="Inserted"><span class="annot"><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160528"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-648"></span><span>
</span><span id="line-649"></span><span id="local-6989586621679160531"><span class="annot"><a href="Data.Set.Internal.html#alteredSet"><span class="hs-identifier hs-type">alteredSet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160531"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160531"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160531"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#AlteredSet"><span class="hs-identifier hs-type">AlteredSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160531"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-650"></span><span id="alteredSet"><span class="annot"><span class="annottext">alteredSet :: forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#alteredSet"><span class="hs-identifier hs-var hs-var">alteredSet</span></a></span></span><span> </span><span id="local-6989586621679159767"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159767"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span id="local-6989586621679159766"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159766"><span class="hs-identifier hs-var">s0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; AlteredSet a
forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="#local-6989586621679159765"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159767"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159766"><span class="hs-identifier hs-var">s0</span></a></span><span>
</span><span id="line-651"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-652"></span><span>    </span><span id="local-6989586621679159764"><span class="annot"><a href="#local-6989586621679159765"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159764"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159764"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159764"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#AlteredSet"><span class="hs-identifier hs-type">AlteredSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159764"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-653"></span><span>    </span><span id="local-6989586621679159765"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="#local-6989586621679159765"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159759"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159759"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159759"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-654"></span><span>    </span><span class="annot"><a href="#local-6989586621679159765"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159758"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159758"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159757"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159756"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159756"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159755"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159755"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159758"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-655"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; AlteredSet a
forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="#local-6989586621679159765"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159758"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159756"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-656"></span><span>            </span><span class="annot"><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-type">Deleted</span></a></span><span> </span><span id="local-6989586621679159754"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159754"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-var">Deleted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159754"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159755"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-657"></span><span>            </span><span class="annot"><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679159753"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159753"><span class="hs-identifier hs-var">i</span></a></span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159753"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159755"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-658"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; AlteredSet a
forall a. Ord a =&gt; a -&gt; Set a -&gt; AlteredSet a
</span><a href="#local-6989586621679159765"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159758"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159755"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-659"></span><span>            </span><span class="annot"><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-type">Deleted</span></a></span><span> </span><span id="local-6989586621679159752"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159752"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-var">Deleted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159756"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159752"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-660"></span><span>            </span><span class="annot"><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679159751"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159751"><span class="hs-identifier hs-var">i</span></a></span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159757"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159756"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159751"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-661"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; AlteredSet a
forall a. Set a -&gt; AlteredSet a
</span><a href="Data.Set.Internal.html#Deleted"><span class="hs-identifier hs-var">Deleted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159756"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159755"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#alteredSet"><span class="hs-pragma hs-type">alteredSet</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">alteredSet</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-668"></span><span class="hs-comment">{--------------------------------------------------------------------
  Subset
--------------------------------------------------------------------}</span><span>
</span><span id="line-671"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/.</span><span>
</span><span id="line-672"></span><span class="hs-comment">-- @(s1 \`isProperSubsetOf\` s2)@ indicates whether @s1@ is a</span><span>
</span><span id="line-673"></span><span class="hs-comment">-- proper subset of @s2@.</span><span>
</span><span id="line-674"></span><span class="hs-comment">--</span><span>
</span><span id="line-675"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-676"></span><span class="hs-comment">-- s1 \`isProperSubsetOf\` s2 = s1 ``isSubsetOf`` s2 &amp;&amp; s1 /= s2</span><span>
</span><span id="line-677"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-678"></span><span id="local-6989586621679160527"><span class="annot"><a href="Data.Set.Internal.html#isProperSubsetOf"><span class="hs-identifier hs-type">isProperSubsetOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160527"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160527"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160527"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-679"></span><span id="isProperSubsetOf"><span class="annot"><span class="annottext">isProperSubsetOf :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isProperSubsetOf"><span class="hs-identifier hs-var hs-var">isProperSubsetOf</span></a></span></span><span> </span><span id="local-6989586621679159746"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159746"><span class="hs-identifier hs-var">s1</span></a></span></span><span> </span><span id="local-6989586621679159745"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159745"><span class="hs-identifier hs-var">s2</span></a></span></span><span>
</span><span id="line-680"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159746"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159745"><span class="hs-identifier hs-var">s2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159746"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159745"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#isProperSubsetOf"><span class="hs-pragma hs-type">isProperSubsetOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-685"></span><span>
</span><span id="line-686"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/.</span><span>
</span><span id="line-687"></span><span class="hs-comment">-- @(s1 \`isSubsetOf\` s2)@ indicates whether @s1@ is a subset of @s2@.</span><span>
</span><span id="line-688"></span><span class="hs-comment">--</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- s1 \`isSubsetOf\` s2 = all (``member`` s2) s1</span><span>
</span><span id="line-691"></span><span class="hs-comment">-- s1 \`isSubsetOf\` s2 = null (s1 ``difference`` s2)</span><span>
</span><span id="line-692"></span><span class="hs-comment">-- s1 \`isSubsetOf\` s2 = s1 ``union`` s2 == s2</span><span>
</span><span id="line-693"></span><span class="hs-comment">-- s1 \`isSubsetOf\` s2 = s1 ``intersection`` s2 == s1</span><span>
</span><span id="line-694"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-695"></span><span id="local-6989586621679159742"><span class="annot"><a href="Data.Set.Internal.html#isSubsetOf"><span class="hs-identifier hs-type">isSubsetOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159742"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159742"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159742"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-696"></span><span id="isSubsetOf"><span class="annot"><span class="annottext">isSubsetOf :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOf"><span class="hs-identifier hs-var hs-var">isSubsetOf</span></a></span></span><span> </span><span id="local-6989586621679159738"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159738"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621679159737"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159737"><span class="hs-identifier hs-var">t2</span></a></span></span><span>
</span><span id="line-697"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159738"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159737"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159738"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159737"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOf"><span class="hs-pragma hs-type">isSubsetOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-702"></span><span class="hs-comment">-- Test whether a set is a subset of another without the *initial*</span><span>
</span><span id="line-703"></span><span class="hs-comment">-- size test.</span><span>
</span><span id="line-704"></span><span class="hs-comment">--</span><span>
</span><span id="line-705"></span><span class="hs-comment">-- This function is structured very much like `difference`, `union`,</span><span>
</span><span id="line-706"></span><span class="hs-comment">-- and `intersection`. Whereas the bounds proofs for those in Blelloch</span><span>
</span><span id="line-707"></span><span class="hs-comment">-- et al needed to accound for both &quot;split work&quot; and &quot;merge work&quot;, we</span><span>
</span><span id="line-708"></span><span class="hs-comment">-- only have to worry about split work here, which is the same as in</span><span>
</span><span id="line-709"></span><span class="hs-comment">-- those functions.</span><span>
</span><span id="line-710"></span><span id="local-6989586621679159736"><span class="annot"><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-type">isSubsetOfX</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159736"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159736"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159736"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-711"></span><span id="isSubsetOfX"><span class="annot"><span class="annottext">isSubsetOfX :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var hs-var">isSubsetOfX</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-712"></span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-713"></span><span class="hs-comment">-- Skip the final split when we hit a singleton.</span><span>
</span><span id="line-714"></span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679159726"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159726"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159725"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159725"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#member"><span class="hs-identifier hs-var">member</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159726"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159725"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-715"></span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159724"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159724"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159723"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159723"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159722"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159722"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159721"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159721"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-716"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159720"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-717"></span><span>    </span><span class="hs-comment">-- Cheap size checks can sometimes save expensive recursive calls when the</span><span>
</span><span id="line-718"></span><span>    </span><span class="hs-comment">-- result will be False. Suppose we check whether [1..10] (with root 4) is</span><span>
</span><span id="line-719"></span><span>    </span><span class="hs-comment">-- a subset of [0..9]. After the first split, we have to check if [1..3] is</span><span>
</span><span id="line-720"></span><span>    </span><span class="hs-comment">-- a subset of [0..3] and if [5..10] is a subset of [5..9]. But we can bail</span><span>
</span><span id="line-721"></span><span>    </span><span class="hs-comment">-- immediately because size [5..10] &gt; size [5..9].</span><span>
</span><span id="line-722"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-723"></span><span>    </span><span class="hs-comment">-- Why not just call `isSubsetOf` on each side to do the size checks?</span><span>
</span><span id="line-724"></span><span>    </span><span class="hs-comment">-- Because that could make a recursive call on the left even though the</span><span>
</span><span id="line-725"></span><span>    </span><span class="hs-comment">-- size check would fail on the right. In principle, we could take this to</span><span>
</span><span id="line-726"></span><span>    </span><span class="hs-comment">-- extremes by maintaining a queue of pairs of sets to be checked, working</span><span>
</span><span id="line-727"></span><span>    </span><span class="hs-comment">-- through the tree level-wise. But that would impose higher administrative</span><span>
</span><span id="line-728"></span><span>    </span><span class="hs-comment">-- costs without obvious benefits. It might be worth considering if we find</span><span>
</span><span id="line-729"></span><span>    </span><span class="hs-comment">-- a way to use it to tighten the bounds in some useful/comprehensible way.</span><span>
</span><span id="line-730"></span><span>    </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159723"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159719"><span class="hs-identifier hs-var">lt</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159722"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159718"><span class="hs-identifier hs-var">gt</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-731"></span><span>    </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159723"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159719"><span class="hs-identifier hs-var">lt</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-identifier hs-var">isSubsetOfX</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159722"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159718"><span class="hs-identifier hs-var">gt</span></a></span><span>
</span><span id="line-732"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-733"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679159719"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159719"><span class="hs-identifier hs-var">lt</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679159720"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159720"><span class="hs-identifier hs-var">found</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679159718"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159718"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Bool, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159724"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159721"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#isSubsetOfX"><span class="hs-pragma hs-type">isSubsetOfX</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-738"></span><span class="hs-comment">{--------------------------------------------------------------------
  Disjoint
--------------------------------------------------------------------}</span><span>
</span><span id="line-741"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. Check whether two sets are disjoint</span><span>
</span><span id="line-742"></span><span class="hs-comment">-- (i.e., their intersection is empty).</span><span>
</span><span id="line-743"></span><span class="hs-comment">--</span><span>
</span><span id="line-744"></span><span class="hs-comment">-- &gt; disjoint (fromList [2,4,6])   (fromList [1,3])     == True</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- &gt; disjoint (fromList [2,4,6,8]) (fromList [2,3,5,7]) == False</span><span>
</span><span id="line-746"></span><span class="hs-comment">-- &gt; disjoint (fromList [1,2])     (fromList [1,2,3,4]) == False</span><span>
</span><span id="line-747"></span><span class="hs-comment">-- &gt; disjoint (fromList [])        (fromList [])        == True</span><span>
</span><span id="line-748"></span><span class="hs-comment">--</span><span>
</span><span id="line-749"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-750"></span><span class="hs-comment">-- xs ``disjoint`` ys = null (xs ``intersection`` ys)</span><span>
</span><span id="line-751"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-752"></span><span class="hs-comment">--</span><span>
</span><span id="line-753"></span><span class="hs-comment">-- @since 0.5.11</span><span>
</span><span id="line-754"></span><span>
</span><span id="line-755"></span><span id="local-6989586621679159717"><span class="annot"><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-type">disjoint</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159717"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159717"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159717"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-756"></span><span id="disjoint"><span class="annot"><span class="annottext">disjoint :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var hs-var">disjoint</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-757"></span><span class="annot"><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var">disjoint</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-758"></span><span class="hs-comment">-- Avoid a split for the singleton case.</span><span>
</span><span id="line-759"></span><span class="annot"><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var">disjoint</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679159709"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159709"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159708"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159708"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159709"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#notMember"><span class="hs-operator hs-var">`notMember`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159708"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-760"></span><span class="annot"><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var">disjoint</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159707"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159707"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159706"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159706"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159705"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159705"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159704"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159704"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-761"></span><span>  </span><span class="hs-comment">-- Analogous implementation to `subsetOfX`</span><span>
</span><span id="line-762"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159703"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var">disjoint</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159706"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159702"><span class="hs-identifier hs-var">lt</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#disjoint"><span class="hs-identifier hs-var">disjoint</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159705"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159701"><span class="hs-identifier hs-var">gt</span></a></span><span>
</span><span id="line-763"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-764"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679159702"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159702"><span class="hs-identifier hs-var">lt</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679159703"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159703"><span class="hs-identifier hs-var">found</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679159701"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159701"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Bool, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159707"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159704"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-765"></span><span>
</span><span id="line-766"></span><span class="hs-comment">{--------------------------------------------------------------------
  Minimal, Maximal
--------------------------------------------------------------------}</span><span>
</span><span id="line-769"></span><span>
</span><span id="line-770"></span><span class="hs-comment">-- We perform call-pattern specialization manually on lookupMin</span><span>
</span><span id="line-771"></span><span class="hs-comment">-- and lookupMax. Otherwise, GHC doesn't seem to do it, which is</span><span>
</span><span id="line-772"></span><span class="hs-comment">-- unfortunate if, for example, someone uses findMin or findMax.</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span id="local-6989586621679160521"><span class="annot"><a href="Data.Set.Internal.html#lookupMinSure"><span class="hs-identifier hs-type">lookupMinSure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679160521"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160521"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160521"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-775"></span><span id="lookupMinSure"><span class="annot"><span class="annottext">lookupMinSure :: forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMinSure"><span class="hs-identifier hs-var hs-var">lookupMinSure</span></a></span></span><span> </span><span id="local-6989586621679159699"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159699"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159699"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-776"></span><span class="annot"><a href="Data.Set.Internal.html#lookupMinSure"><span class="hs-identifier hs-var">lookupMinSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159698"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159698"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159697"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159697"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; a
forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMinSure"><span class="hs-identifier hs-var">lookupMinSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159698"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159697"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-777"></span><span>
</span><span id="line-778"></span><span class="hs-comment">-- | /O(log n)/. The minimal element of a set.</span><span>
</span><span id="line-779"></span><span class="hs-comment">--</span><span>
</span><span id="line-780"></span><span class="hs-comment">-- @since 0.5.9</span><span>
</span><span id="line-781"></span><span>
</span><span id="line-782"></span><span id="local-6989586621679160519"><span class="annot"><a href="Data.Set.Internal.html#lookupMin"><span class="hs-identifier hs-type">lookupMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160519"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160519"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-783"></span><span id="lookupMin"><span class="annot"><span class="annottext">lookupMin :: forall a. Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupMin"><span class="hs-identifier hs-var hs-var">lookupMin</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-784"></span><span class="annot"><a href="Data.Set.Internal.html#lookupMin"><span class="hs-identifier hs-var">lookupMin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159696"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159696"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159695"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159695"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; a -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; a
forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMinSure"><span class="hs-identifier hs-var">lookupMinSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159696"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159695"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span class="hs-comment">-- | /O(log n)/. The minimal element of a set.</span><span>
</span><span id="line-787"></span><span id="local-6989586621679160635"><span class="annot"><a href="Data.Set.Internal.html#findMin"><span class="hs-identifier hs-type">findMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160635"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160635"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-788"></span><span id="findMin"><span class="annot"><span class="annottext">findMin :: forall a. Set a -&gt; a
</span><a href="Data.Set.Internal.html#findMin"><span class="hs-identifier hs-var hs-var">findMin</span></a></span></span><span> </span><span id="local-6989586621679159691"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159691"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-789"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679159690"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159690"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Maybe a
forall a. Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupMin"><span class="hs-identifier hs-var">lookupMin</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159691"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159690"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-790"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.findMin: empty set has no minimal element&quot;</span></span><span>
</span><span id="line-791"></span><span>
</span><span id="line-792"></span><span id="local-6989586621679159689"><span class="annot"><a href="Data.Set.Internal.html#lookupMaxSure"><span class="hs-identifier hs-type">lookupMaxSure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679159689"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159689"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159689"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-793"></span><span id="lookupMaxSure"><span class="annot"><span class="annottext">lookupMaxSure :: forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMaxSure"><span class="hs-identifier hs-var hs-var">lookupMaxSure</span></a></span></span><span> </span><span id="local-6989586621679159687"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159687"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159687"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-794"></span><span class="annot"><a href="Data.Set.Internal.html#lookupMaxSure"><span class="hs-identifier hs-var">lookupMaxSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159686"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159686"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159685"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159685"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; a
forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMaxSure"><span class="hs-identifier hs-var">lookupMaxSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159686"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159685"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-795"></span><span>
</span><span id="line-796"></span><span class="hs-comment">-- | /O(log n)/. The maximal element of a set.</span><span>
</span><span id="line-797"></span><span class="hs-comment">--</span><span>
</span><span id="line-798"></span><span class="hs-comment">-- @since 0.5.9</span><span>
</span><span id="line-799"></span><span>
</span><span id="line-800"></span><span id="local-6989586621679159684"><span class="annot"><a href="Data.Set.Internal.html#lookupMax"><span class="hs-identifier hs-type">lookupMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159684"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159684"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-801"></span><span id="lookupMax"><span class="annot"><span class="annottext">lookupMax :: forall a. Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupMax"><span class="hs-identifier hs-var hs-var">lookupMax</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-802"></span><span class="annot"><a href="Data.Set.Internal.html#lookupMax"><span class="hs-identifier hs-var">lookupMax</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159683"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159683"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159682"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159682"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; a -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; a
forall a. a -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#lookupMaxSure"><span class="hs-identifier hs-var">lookupMaxSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159683"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159682"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-803"></span><span>
</span><span id="line-804"></span><span class="hs-comment">-- | /O(log n)/. The maximal element of a set.</span><span>
</span><span id="line-805"></span><span id="local-6989586621679159681"><span class="annot"><a href="Data.Set.Internal.html#findMax"><span class="hs-identifier hs-type">findMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159681"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159681"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-806"></span><span id="findMax"><span class="annot"><span class="annottext">findMax :: forall a. Set a -&gt; a
</span><a href="Data.Set.Internal.html#findMax"><span class="hs-identifier hs-var hs-var">findMax</span></a></span></span><span> </span><span id="local-6989586621679159678"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159678"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-807"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679159677"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159677"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Maybe a
forall a. Set a -&gt; Maybe a
</span><a href="Data.Set.Internal.html#lookupMax"><span class="hs-identifier hs-var">lookupMax</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159678"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159677"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-808"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.findMax: empty set has no maximal element&quot;</span></span><span>
</span><span id="line-809"></span><span>
</span><span id="line-810"></span><span class="hs-comment">-- | /O(log n)/. Delete the minimal element. Returns an empty set if the set is empty.</span><span>
</span><span id="line-811"></span><span id="local-6989586621679160513"><span class="annot"><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier hs-type">deleteMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160513"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160513"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-812"></span><span id="deleteMin"><span class="annot"><span class="annottext">deleteMin :: forall a. Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier hs-var hs-var">deleteMin</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679159676"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159676"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159676"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-813"></span><span class="annot"><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier hs-var">deleteMin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159675"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159675"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159674"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159674"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159673"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159673"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159675"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a
forall a. Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier hs-var">deleteMin</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159674"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159673"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-814"></span><span class="annot"><a href="Data.Set.Internal.html#deleteMin"><span class="hs-identifier hs-var">deleteMin</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-815"></span><span>
</span><span id="line-816"></span><span class="hs-comment">-- | /O(log n)/. Delete the maximal element. Returns an empty set if the set is empty.</span><span>
</span><span id="line-817"></span><span id="local-6989586621679159672"><span class="annot"><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier hs-type">deleteMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159672"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159672"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-818"></span><span id="deleteMax"><span class="annot"><span class="annottext">deleteMax :: forall a. Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier hs-var hs-var">deleteMax</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159671"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159671"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159671"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-819"></span><span class="annot"><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier hs-var">deleteMax</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159670"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159670"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159669"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159669"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159668"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159668"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159670"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159669"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a
forall a. Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier hs-var">deleteMax</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159668"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-820"></span><span class="annot"><a href="Data.Set.Internal.html#deleteMax"><span class="hs-identifier hs-var">deleteMax</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-821"></span><span>
</span><span id="line-822"></span><span class="hs-comment">{--------------------------------------------------------------------
  Union.
--------------------------------------------------------------------}</span><span>
</span><span id="line-825"></span><span class="hs-comment">-- | The union of the sets in a Foldable structure : (@'unions' == 'foldl' 'union' 'empty'@).</span><span>
</span><span id="line-826"></span><span id="local-6989586621679160676"><span id="local-6989586621679160677"><span class="annot"><a href="Data.Set.Internal.html#unions"><span class="hs-identifier hs-type">unions</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#Foldable"><span class="hs-identifier hs-type">Foldable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160677"><span class="hs-identifier hs-type">f</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160676"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160677"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160676"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160676"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-827"></span><span id="unions"><span class="annot"><span class="annottext">unions :: forall (f :: * -&gt; *) a. (Foldable f, Ord a) =&gt; f (Set a) -&gt; Set a
</span><a href="Data.Set.Internal.html#unions"><span class="hs-identifier hs-var hs-var">unions</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Set a -&gt; Set a -&gt; Set a) -&gt; Set a -&gt; f (Set a) -&gt; Set a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#unions"><span class="hs-pragma hs-type">unions</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-832"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. The union of two sets, preferring the first set when</span><span>
</span><span id="line-833"></span><span class="hs-comment">-- equal elements are encountered.</span><span>
</span><span id="line-834"></span><span id="local-6989586621679159663"><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-type">union</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159663"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159663"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159663"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159663"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-835"></span><span id="union"><span class="annot"><span class="annottext">union :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var hs-var">union</span></a></span></span><span> </span><span id="local-6989586621679159652"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159652"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159652"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-836"></span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span id="local-6989586621679159651"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159651"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679159650"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159650"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertR"><span class="hs-identifier hs-var">insertR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159650"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159651"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-837"></span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679159649"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159649"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159648"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159648"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159649"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159648"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-838"></span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679159647"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159647"><span class="hs-identifier hs-var">t2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159647"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-839"></span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span id="local-6989586621679159646"><span class="annot"><span class="annottext">t1 :: Set a
</span><a href="#local-6989586621679159646"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159645"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159645"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159644"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159644"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679159643"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159643"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159642"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159642"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var">splitS</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159645"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159642"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-840"></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679159640"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159640"><span class="hs-identifier hs-var">l2</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159638"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159638"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-841"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159637"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159644"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159636"><span class="hs-identifier hs-var">r1r2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159643"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159646"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-842"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159645"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159637"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159636"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-843"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159637"><span class="annot"><span class="annottext">l1l2 :: Set a
</span><a href="#local-6989586621679159637"><span class="hs-identifier hs-var hs-var">l1l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159644"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159640"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-844"></span><span>          </span><span class="hs-glyph">!</span><span id="local-6989586621679159636"><span class="annot"><span class="annottext">r1r2 :: Set a
</span><a href="#local-6989586621679159636"><span class="hs-identifier hs-var hs-var">r1r2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#union"><span class="hs-identifier hs-var">union</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159643"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159638"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#union"><span class="hs-pragma hs-type">union</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-849"></span><span class="hs-comment">{--------------------------------------------------------------------
  Difference
--------------------------------------------------------------------}</span><span>
</span><span id="line-852"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. Difference of two sets.</span><span>
</span><span id="line-853"></span><span id="local-6989586621679159635"><span class="annot"><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-type">difference</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159635"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159635"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159635"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159635"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-854"></span><span id="difference"><span class="annot"><span class="annottext">difference :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var hs-var">difference</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-855"></span><span class="annot"><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var">difference</span></a></span><span> </span><span id="local-6989586621679159628"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159628"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159628"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-856"></span><span class="annot"><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var">difference</span></a></span><span> </span><span id="local-6989586621679159627"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159627"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159626"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159626"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159625"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159625"><span class="hs-identifier hs-var">l2</span></a></span></span><span> </span><span id="local-6989586621679159624"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159624"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Set a)
</span><a href="Data.Set.Internal.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159626"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159627"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-857"></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621679159623"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159623"><span class="hs-identifier hs-var">l1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159622"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159622"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-858"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159621"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159620"><span class="hs-identifier hs-var">r1r2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159627"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159627"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-859"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159621"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159620"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-860"></span><span>     </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159621"><span class="annot"><span class="annottext">l1l2 :: Set a
</span><a href="#local-6989586621679159621"><span class="hs-identifier hs-var hs-var">l1l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var">difference</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159623"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159625"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-861"></span><span>           </span><span class="hs-glyph">!</span><span id="local-6989586621679159620"><span class="annot"><span class="annottext">r1r2 :: Set a
</span><a href="#local-6989586621679159620"><span class="hs-identifier hs-var hs-var">r1r2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#difference"><span class="hs-identifier hs-var">difference</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159622"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159624"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#difference"><span class="hs-pragma hs-type">difference</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-866"></span><span class="hs-comment">{--------------------------------------------------------------------
  Intersection
--------------------------------------------------------------------}</span><span>
</span><span id="line-869"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. The intersection of two sets.</span><span>
</span><span id="line-870"></span><span class="hs-comment">-- Elements of the result come from the first set, so for example</span><span>
</span><span id="line-871"></span><span class="hs-comment">--</span><span>
</span><span id="line-872"></span><span class="hs-comment">-- &gt; import qualified Data.Set as S</span><span>
</span><span id="line-873"></span><span class="hs-comment">-- &gt; data AB = A | B deriving Show</span><span>
</span><span id="line-874"></span><span class="hs-comment">-- &gt; instance Ord AB where compare _ _ = EQ</span><span>
</span><span id="line-875"></span><span class="hs-comment">-- &gt; instance Eq AB where _ == _ = True</span><span>
</span><span id="line-876"></span><span class="hs-comment">-- &gt; main = print (S.singleton A `S.intersection` S.singleton B,</span><span>
</span><span id="line-877"></span><span class="hs-comment">-- &gt;               S.singleton B `S.intersection` S.singleton A)</span><span>
</span><span id="line-878"></span><span class="hs-comment">--</span><span>
</span><span id="line-879"></span><span class="hs-comment">-- prints @(fromList [A],fromList [B])@.</span><span>
</span><span id="line-880"></span><span id="local-6989586621679159619"><span class="annot"><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-type">intersection</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679159619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159619"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-881"></span><span id="intersection"><span class="annot"><span class="annottext">intersection :: forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-var hs-var">intersection</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-882"></span><span class="annot"><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-var">intersection</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-883"></span><span class="annot"><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-var">intersection</span></a></span><span> </span><span id="local-6989586621679159614"><span class="annot"><span class="annottext">t1 :: Set a
</span><a href="#local-6989586621679159614"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159613"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159613"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159612"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159612"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679159611"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159611"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159610"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159610"><span class="hs-identifier hs-var">t2</span></a></span></span><span>
</span><span id="line-884"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159609"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159608"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159612"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159607"><span class="hs-identifier hs-var">r1r2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159611"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-885"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159614"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-886"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159613"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159608"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159607"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-887"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159608"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159607"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-888"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-889"></span><span>    </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679159606"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159606"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159609"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159609"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159605"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159605"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Bool, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159613"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159610"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-890"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679159608"><span class="annot"><span class="annottext">l1l2 :: Set a
</span><a href="#local-6989586621679159608"><span class="hs-identifier hs-var hs-var">l1l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-var">intersection</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159612"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159606"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-891"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679159607"><span class="annot"><span class="annottext">r1r2 :: Set a
</span><a href="#local-6989586621679159607"><span class="hs-identifier hs-var hs-var">r1r2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#intersection"><span class="hs-identifier hs-var">intersection</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159611"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159605"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#intersection"><span class="hs-pragma hs-type">intersection</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-896"></span><span class="hs-comment">{--------------------------------------------------------------------
  Filter and partition
--------------------------------------------------------------------}</span><span>
</span><span id="line-899"></span><span class="hs-comment">-- | /O(n)/. Filter all elements that satisfy the predicate.</span><span>
</span><span id="line-900"></span><span id="local-6989586621679160502"><span class="annot"><a href="Data.Set.Internal.html#filter"><span class="hs-identifier hs-type">filter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160502"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160502"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160502"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-901"></span><span id="filter"><span class="annot"><span class="annottext">filter :: forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#filter"><span class="hs-identifier hs-var hs-var">filter</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-902"></span><span class="annot"><a href="Data.Set.Internal.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span id="local-6989586621679159604"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159604"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679159603"><span class="annot"><span class="annottext">t :: Set a
</span><a href="#local-6989586621679159603"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159602"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159602"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159601"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159601"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159600"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159600"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-903"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159604"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159602"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159601"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159599"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159600"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159598"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-904"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159603"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-905"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159602"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159599"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159598"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-906"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159599"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159598"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-907"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-908"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679159599"><span class="annot"><span class="annottext">l' :: Set a
</span><a href="#local-6989586621679159599"><span class="hs-identifier hs-var hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159604"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159601"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-909"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679159598"><span class="annot"><span class="annottext">r' :: Set a
</span><a href="#local-6989586621679159598"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159604"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159600"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-910"></span><span>
</span><span id="line-911"></span><span class="hs-comment">-- | /O(n)/. Partition the set into two sets, one with all elements that satisfy</span><span>
</span><span id="line-912"></span><span class="hs-comment">-- the predicate and one with all elements that don't satisfy the predicate.</span><span>
</span><span id="line-913"></span><span class="hs-comment">-- See also 'split'.</span><span>
</span><span id="line-914"></span><span id="local-6989586621679160500"><span class="annot"><a href="Data.Set.Internal.html#partition"><span class="hs-identifier hs-type">partition</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160500"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160500"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160500"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160500"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-915"></span><span id="partition"><span class="annot"><span class="annottext">partition :: forall a. (a -&gt; Bool) -&gt; Set a -&gt; (Set a, Set a)
</span><a href="Data.Set.Internal.html#partition"><span class="hs-identifier hs-var hs-var">partition</span></a></span></span><span> </span><span id="local-6989586621679159597"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159597"><span class="hs-identifier hs-var">p0</span></a></span></span><span> </span><span id="local-6989586621679159596"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159596"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Set a) (Set a) -&gt; (Set a, Set a))
-&gt; StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall {a}. (a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159594"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159597"><span class="hs-identifier hs-var">p0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159596"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-916"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-917"></span><span>    </span><span id="local-6989586621679159594"><span class="annot"><span class="annottext">go :: (a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159594"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-918"></span><span>    </span><span class="annot"><a href="#local-6989586621679159594"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159593"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159593"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679159592"><span class="annot"><span class="annottext">t :: Set a
</span><a href="#local-6989586621679159592"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159591"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159591"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159590"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159590"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159589"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159589"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159594"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159593"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159590"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159594"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159593"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159589"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-919"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679159588"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159588"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159587"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159587"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159586"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159586"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159585"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159585"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-920"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159593"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159591"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159588"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159590"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159586"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159589"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-921"></span><span>                        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159592"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-922"></span><span>                        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159591"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159588"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159586"><span class="hs-identifier hs-var">r1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159587"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159585"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-923"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159588"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159586"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span>
</span><span id="line-924"></span><span>                       </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159587"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159590"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159585"><span class="hs-identifier hs-var">r2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Bool
forall a. a -&gt; a -&gt; Bool
</span><a href="Utils.Containers.Internal.PtrEquality.html#ptrEq"><span class="hs-operator hs-var">`ptrEq`</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159589"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-925"></span><span>                        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159592"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-926"></span><span>                        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159591"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159587"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159585"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span class="hs-comment">{----------------------------------------------------------------------
  Map
----------------------------------------------------------------------}</span><span>
</span><span id="line-931"></span><span>
</span><span id="line-932"></span><span class="hs-comment">-- | /O(n*log n)/.</span><span>
</span><span id="line-933"></span><span class="hs-comment">-- @'map' f s@ is the set obtained by applying @f@ to each element of @s@.</span><span>
</span><span id="line-934"></span><span class="hs-comment">--</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- It's worth noting that the size of the result may be smaller if,</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- for some @(x,y)@, @x \/= y &amp;&amp; f x == f y@</span><span>
</span><span id="line-937"></span><span>
</span><span id="line-938"></span><span id="local-6989586621679160492"><span id="local-6989586621679160493"><span class="annot"><a href="Data.Set.Internal.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160493"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160492"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679160493"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160492"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160493"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-939"></span><span id="map"><span class="annot"><span class="annottext">map :: forall b a. Ord b =&gt; (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679159582"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159582"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[b] -&gt; Set b
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="annot"><span class="annottext">([b] -&gt; Set b) -&gt; (Set a -&gt; [b]) -&gt; Set a -&gt; Set b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; [a] -&gt; [b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">List.map</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159582"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">([a] -&gt; [b]) -&gt; (Set a -&gt; [a]) -&gt; Set a -&gt; [b]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-944"></span><span class="hs-comment">-- | /O(n)/. The</span><span>
</span><span id="line-945"></span><span class="hs-comment">--</span><span>
</span><span id="line-946"></span><span class="hs-comment">-- @'mapMonotonic' f s == 'map' f s@, but works only when @f@ is strictly increasing.</span><span>
</span><span id="line-947"></span><span class="hs-comment">-- /The precondition is not checked./</span><span>
</span><span id="line-948"></span><span class="hs-comment">-- Semi-formally, we have:</span><span>
</span><span id="line-949"></span><span class="hs-comment">--</span><span>
</span><span id="line-950"></span><span class="hs-comment">-- &gt; and [x &lt; y ==&gt; f x &lt; f y | x &lt;- ls, y &lt;- ls]</span><span>
</span><span id="line-951"></span><span class="hs-comment">-- &gt;                     ==&gt; mapMonotonic f s == map f s</span><span>
</span><span id="line-952"></span><span class="hs-comment">-- &gt;     where ls = toList s</span><span>
</span><span id="line-953"></span><span>
</span><span id="line-954"></span><span id="local-6989586621679160483"><span id="local-6989586621679160484"><span class="annot"><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-type">mapMonotonic</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160484"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679160483"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160484"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160483"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-955"></span><span id="mapMonotonic"><span class="annot"><span class="annottext">mapMonotonic :: forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var hs-var">mapMonotonic</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set b
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-956"></span><span class="annot"><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span id="local-6989586621679159581"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159581"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159580"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159580"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span id="local-6989586621679159579"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159579"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159578"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159578"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159577"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159577"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; b -&gt; Set b -&gt; Set b -&gt; Set b
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159580"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159581"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159579"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Set a -&gt; Set b
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159581"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159578"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Set a -&gt; Set b
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679159581"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159577"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span class="hs-comment">{--------------------------------------------------------------------
  Fold
--------------------------------------------------------------------}</span><span>
</span><span id="line-961"></span><span class="hs-comment">-- | /O(n)/. Fold the elements in the set using the given right-associative</span><span>
</span><span id="line-962"></span><span class="hs-comment">-- binary operator. This function is an equivalent of 'foldr' and is present</span><span>
</span><span id="line-963"></span><span class="hs-comment">-- for compatibility only.</span><span>
</span><span id="line-964"></span><span class="hs-comment">--</span><span>
</span><span id="line-965"></span><span class="hs-comment">-- /Please note that fold will be deprecated in the future and removed./</span><span>
</span><span id="line-966"></span><span id="local-6989586621679159575"><span id="local-6989586621679159576"><span class="annot"><a href="Data.Set.Internal.html#fold"><span class="hs-identifier hs-type">fold</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159576"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159575"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159575"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159575"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159576"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159575"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-967"></span><span id="fold"><span class="annot"><span class="annottext">fold :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#fold"><span class="hs-identifier hs-var hs-var">fold</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span>
</span><span id="line-968"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fold"><span class="hs-pragma hs-type">fold</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-969"></span><span>
</span><span id="line-970"></span><span class="hs-comment">-- | /O(n)/. Fold the elements in the set using the given right-associative</span><span>
</span><span id="line-971"></span><span class="hs-comment">-- binary operator, such that @'foldr' f z == 'Prelude.foldr' f z . 'toAscList'@.</span><span>
</span><span id="line-972"></span><span class="hs-comment">--</span><span>
</span><span id="line-973"></span><span class="hs-comment">-- For example,</span><span>
</span><span id="line-974"></span><span class="hs-comment">--</span><span>
</span><span id="line-975"></span><span class="hs-comment">-- &gt; toAscList set = foldr (:) [] set</span><span>
</span><span id="line-976"></span><span id="local-6989586621679159573"><span id="local-6989586621679159574"><span class="annot"><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-type">foldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159574"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159573"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159573"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159573"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159574"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159573"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-977"></span><span id="foldr"><span class="annot"><span class="annottext">foldr :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-var hs-var">foldr</span></a></span></span><span> </span><span id="local-6989586621679159572"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679159572"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159571"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159571"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159571"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-978"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-979"></span><span>    </span><span id="local-6989586621679159570"><span class="annot"><span class="annottext">go :: b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159570"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159569"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159569"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159569"><span class="hs-identifier hs-var">z'</span></a></span><span>
</span><span id="line-980"></span><span>    </span><span class="annot"><a href="#local-6989586621679159570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159568"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159568"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159567"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159567"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159566"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159566"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159565"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159565"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679159572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159567"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159568"><span class="hs-identifier hs-var">z'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159565"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159566"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-981"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-982"></span><span>
</span><span id="line-983"></span><span class="hs-comment">-- | /O(n)/. A strict version of 'foldr'. Each application of the operator is</span><span>
</span><span id="line-984"></span><span class="hs-comment">-- evaluated before using the result in the next application. This</span><span>
</span><span id="line-985"></span><span class="hs-comment">-- function is strict in the starting value.</span><span>
</span><span id="line-986"></span><span id="local-6989586621679159563"><span id="local-6989586621679159564"><span class="annot"><a href="Data.Set.Internal.html#foldr%27"><span class="hs-identifier hs-type">foldr'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159564"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159563"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159563"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159563"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159564"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159563"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-987"></span><span id="foldr%27"><span class="annot"><span class="annottext">foldr' :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr%27"><span class="hs-identifier hs-var hs-var">foldr'</span></a></span></span><span> </span><span id="local-6989586621679159562"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679159562"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159561"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159561"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159560"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159561"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-988"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-989"></span><span>    </span><span id="local-6989586621679159560"><span class="annot"><span class="annottext">go :: b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159560"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159559"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159559"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159559"><span class="hs-identifier hs-var">z'</span></a></span><span>
</span><span id="line-990"></span><span>    </span><span class="annot"><a href="#local-6989586621679159560"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159558"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159558"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159557"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159557"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159556"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159556"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159555"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159555"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159560"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679159562"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159557"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Set a -&gt; b
</span><a href="#local-6989586621679159560"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159558"><span class="hs-identifier hs-var">z'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159555"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159556"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-991"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldr%27"><span class="hs-pragma hs-type">foldr'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-992"></span><span>
</span><span id="line-993"></span><span class="hs-comment">-- | /O(n)/. Fold the elements in the set using the given left-associative</span><span>
</span><span id="line-994"></span><span class="hs-comment">-- binary operator, such that @'foldl' f z == 'Prelude.foldl' f z . 'toAscList'@.</span><span>
</span><span id="line-995"></span><span class="hs-comment">--</span><span>
</span><span id="line-996"></span><span class="hs-comment">-- For example,</span><span>
</span><span id="line-997"></span><span class="hs-comment">--</span><span>
</span><span id="line-998"></span><span class="hs-comment">-- &gt; toDescList set = foldl (flip (:)) [] set</span><span>
</span><span id="line-999"></span><span id="local-6989586621679159553"><span id="local-6989586621679159554"><span class="annot"><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier hs-type">foldl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159554"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159553"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159554"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159554"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159553"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159554"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1000"></span><span id="foldl"><span class="annot"><span class="annottext">foldl :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier hs-var hs-var">foldl</span></a></span></span><span> </span><span id="local-6989586621679159552"><span class="annot"><span class="annottext">a -&gt; b -&gt; a
</span><a href="#local-6989586621679159552"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159551"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159551"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159550"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159551"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1001"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1002"></span><span>    </span><span id="local-6989586621679159550"><span class="annot"><span class="annottext">go :: a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159550"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159549"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159549"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159549"><span class="hs-identifier hs-var">z'</span></a></span><span>
</span><span id="line-1003"></span><span>    </span><span class="annot"><a href="#local-6989586621679159550"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159548"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159548"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159547"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159547"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159546"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159546"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159545"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159545"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159550"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
</span><a href="#local-6989586621679159552"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159550"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159548"><span class="hs-identifier hs-var">z'</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159546"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159547"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159545"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1004"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1005"></span><span>
</span><span id="line-1006"></span><span class="hs-comment">-- | /O(n)/. A strict version of 'foldl'. Each application of the operator is</span><span>
</span><span id="line-1007"></span><span class="hs-comment">-- evaluated before using the result in the next application. This</span><span>
</span><span id="line-1008"></span><span class="hs-comment">-- function is strict in the starting value.</span><span>
</span><span id="line-1009"></span><span id="local-6989586621679159543"><span id="local-6989586621679159544"><span class="annot"><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier hs-type">foldl'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159544"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159543"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159544"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159544"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159543"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159544"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1010"></span><span id="foldl%27"><span class="annot"><span class="annottext">foldl' :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl%27"><span class="hs-identifier hs-var hs-var">foldl'</span></a></span></span><span> </span><span id="local-6989586621679159542"><span class="annot"><span class="annottext">a -&gt; b -&gt; a
</span><a href="#local-6989586621679159542"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679159541"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159541"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159540"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159541"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1011"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1012"></span><span>    </span><span id="local-6989586621679159540"><span class="annot"><span class="annottext">go :: a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159540"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159539"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159539"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159539"><span class="hs-identifier hs-var">z'</span></a></span><span>
</span><span id="line-1013"></span><span>    </span><span class="annot"><a href="#local-6989586621679159540"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159538"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159538"><span class="hs-identifier hs-var">z'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159537"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159537"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159536"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159536"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159535"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159535"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159540"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
</span><a href="#local-6989586621679159542"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set b -&gt; a
</span><a href="#local-6989586621679159540"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159538"><span class="hs-identifier hs-var">z'</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159536"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679159537"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159535"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1014"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1015"></span><span>
</span><span id="line-1016"></span><span class="hs-comment">{--------------------------------------------------------------------
  List variations
--------------------------------------------------------------------}</span><span>
</span><span id="line-1019"></span><span class="hs-comment">-- | /O(n)/. An alias of 'toAscList'. The elements of a set in ascending order.</span><span>
</span><span id="line-1020"></span><span class="hs-comment">-- Subject to list fusion.</span><span>
</span><span id="line-1021"></span><span id="local-6989586621679159534"><span class="annot"><a href="Data.Set.Internal.html#elems"><span class="hs-identifier hs-type">elems</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159534"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159534"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1022"></span><span id="elems"><span class="annot"><span class="annottext">elems :: forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#elems"><span class="hs-identifier hs-var hs-var">elems</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span>
</span><span id="line-1023"></span><span>
</span><span id="line-1024"></span><span class="hs-comment">{--------------------------------------------------------------------
  Lists
--------------------------------------------------------------------}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 708
</span><span class="hs-comment">-- | @since 0.5.6.2</span><span>
</span><span id="line-1029"></span><span id="local-6989586621679160467"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159531"><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160467"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#IsList"><span class="hs-identifier hs-type">GHCExts.IsList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160467"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1030"></span><span>  </span><span class="hs-keyword">type</span><span> </span><span id="Item"><span class="annot"><a href="../../base/src/GHC.Exts.html#Item"><span class="hs-identifier hs-var">Item</span></a></span></span><span> </span><span id="local-6989586621679160467"><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160467"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621679160467"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-1031"></span><span>  </span><span id="local-6989586621679159527"><span class="annot"><span class="annottext">fromList :: [Item (Set a)] -&gt; Set a
</span><a href="../../base/src/GHC.Exts.html#fromList"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Item (Set a)] -&gt; Set a
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span>
</span><span id="line-1032"></span><span>  </span><span id="local-6989586621679159526"><span class="annot"><span class="annottext">toList :: Set a -&gt; [Item (Set a)]
</span><a href="../../base/src/GHC.Exts.html#toList"><span class="hs-identifier hs-var hs-var hs-var hs-var">toList</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [Item (Set a)]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1035"></span><span class="hs-comment">-- | /O(n)/. Convert the set to a list of elements. Subject to list fusion.</span><span>
</span><span id="line-1036"></span><span id="local-6989586621679159525"><span class="annot"><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-type">toList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159525"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159525"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1037"></span><span id="toList"><span class="annot"><span class="annottext">toList :: forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var hs-var">toList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span>
</span><span id="line-1038"></span><span>
</span><span id="line-1039"></span><span class="hs-comment">-- | /O(n)/. Convert the set to an ascending list of elements. Subject to list fusion.</span><span>
</span><span id="line-1040"></span><span id="local-6989586621679159524"><span class="annot"><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-type">toAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159524"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159524"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1041"></span><span id="toAscList"><span class="annot"><span class="annottext">toAscList :: forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var hs-var">toAscList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; [a] -&gt; [a]) -&gt; [a] -&gt; Set a -&gt; [a]
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1042"></span><span>
</span><span id="line-1043"></span><span class="hs-comment">-- | /O(n)/. Convert the set to a descending list of elements. Subject to list</span><span>
</span><span id="line-1044"></span><span class="hs-comment">-- fusion.</span><span>
</span><span id="line-1045"></span><span id="local-6989586621679159523"><span class="annot"><a href="Data.Set.Internal.html#toDescList"><span class="hs-identifier hs-type">toDescList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159523"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1046"></span><span id="toDescList"><span class="annot"><span class="annottext">toDescList :: forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toDescList"><span class="hs-identifier hs-var hs-var">toDescList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; a -&gt; [a]) -&gt; [a] -&gt; Set a -&gt; [a]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; [a] -&gt; [a]) -&gt; [a] -&gt; a -&gt; [a]
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1047"></span><span>
</span><span id="line-1048"></span><span class="hs-comment">-- List fusion for the list generating functions.</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-comment">-- The foldrFB and foldlFB are foldr and foldl equivalents, used for list fusion.</span><span>
</span><span id="line-1051"></span><span class="hs-comment">-- They are important to convert unfused to{Asc,Desc}List back, see mapFB in prelude.</span><span>
</span><span id="line-1052"></span><span id="local-6989586621679159520"><span id="local-6989586621679159521"><span class="annot"><a href="Data.Set.Internal.html#foldrFB"><span class="hs-identifier hs-type">foldrFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159521"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159520"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159520"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159520"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159521"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159520"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1053"></span><span id="foldrFB"><span class="annot"><span class="annottext">foldrFB :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldrFB"><span class="hs-identifier hs-var hs-var">foldrFB</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span>
</span><span id="line-1054"></span><span class="hs-pragma">{-# INLINE</span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldrFB"><span class="hs-pragma hs-type">foldrFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1055"></span><span id="local-6989586621679159517"><span id="local-6989586621679159518"><span class="annot"><a href="Data.Set.Internal.html#foldlFB"><span class="hs-identifier hs-type">foldlFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159518"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159517"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159518"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159518"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159517"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159518"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1056"></span><span id="foldlFB"><span class="annot"><span class="annottext">foldlFB :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldlFB"><span class="hs-identifier hs-var hs-var">foldlFB</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; a) -&gt; a -&gt; Set b -&gt; a
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span>
</span><span id="line-1057"></span><span class="hs-pragma">{-# INLINE</span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldlFB"><span class="hs-pragma hs-type">foldlFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1058"></span><span>
</span><span id="line-1059"></span><span class="hs-comment">-- Inline elems and toList, so that we need to fuse only toAscList.</span><span>
</span><span id="line-1060"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#elems"><span class="hs-pragma hs-type">elems</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1061"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toList"><span class="hs-pragma hs-type">toList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1062"></span><span>
</span><span id="line-1063"></span><span class="hs-comment">-- The fusion is enabled up to phase 2 included. If it does not succeed,</span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- convert in phase 1 the expanded to{Asc,Desc}List calls back to</span><span>
</span><span id="line-1065"></span><span class="hs-comment">-- to{Asc,Desc}List.  In phase 0, we inline fold{lr}FB (which were used in</span><span>
</span><span id="line-1066"></span><span class="hs-comment">-- a list fusion, otherwise it would go away in phase 1), and let compiler do</span><span>
</span><span id="line-1067"></span><span class="hs-comment">-- whatever it wants with to{Asc,Desc}List -- it was forbidden to inline it</span><span>
</span><span id="line-1068"></span><span class="hs-comment">-- before phase 0, otherwise the fusion rules would not fire at all.</span><span>
</span><span id="line-1069"></span><span class="hs-pragma">{-# NOINLINE</span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toAscList"><span class="hs-pragma hs-type">toAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1070"></span><span class="hs-pragma">{-# NOINLINE</span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toDescList"><span class="hs-pragma hs-type">toDescList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1071"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;Set.toAscList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679159515"><span class="annot"><a href="#local-6989586621679159515"><span class="hs-pragma hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toAscList"><span class="hs-pragma hs-type">toAscList</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159515"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679159514"><span class="annot"><a href="#local-6989586621679159514"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679159513"><span class="annot"><a href="#local-6989586621679159513"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldrFB"><span class="hs-pragma hs-type">foldrFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159514"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159513"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159515"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1072"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;Set.toAscListBack&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldrFB"><span class="hs-pragma hs-type">foldrFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toAscList"><span class="hs-pragma hs-type">toAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1073"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;Set.toDescList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679159512"><span class="annot"><a href="#local-6989586621679159512"><span class="hs-pragma hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toDescList"><span class="hs-pragma hs-type">toDescList</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159512"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679159511"><span class="annot"><a href="#local-6989586621679159511"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679159510"><span class="annot"><a href="#local-6989586621679159510"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldlFB"><span class="hs-pragma hs-type">foldlFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679159509"><span class="annot"><a href="#local-6989586621679159509"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679159508"><span class="annot"><a href="#local-6989586621679159508"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159511"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159508"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159509"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679159510"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159512"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1074"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;Set.toDescListBack&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#foldlFB"><span class="hs-pragma hs-type">foldlFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679159507"><span class="annot"><a href="#local-6989586621679159507"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679159506"><span class="annot"><a href="#local-6989586621679159506"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679159506"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">:</span></span><span> </span><span class="annot"><a href="#local-6989586621679159507"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#toDescList"><span class="hs-pragma hs-type">toDescList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1077"></span><span class="hs-comment">-- | /O(n*log n)/. Create a set from a list of elements.</span><span>
</span><span id="line-1078"></span><span class="hs-comment">--</span><span>
</span><span id="line-1079"></span><span class="hs-comment">-- If the elements are ordered, a linear-time implementation is used,</span><span>
</span><span id="line-1080"></span><span class="hs-comment">-- with the performance equal to 'fromDistinctAscList'.</span><span>
</span><span id="line-1081"></span><span>
</span><span id="line-1082"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromList or in</span><span>
</span><span id="line-1083"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1084"></span><span id="local-6989586621679160594"><span class="annot"><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-type">fromList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160594"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679160594"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160594"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1085"></span><span id="fromList"><span class="annot"><span class="annottext">fromList :: forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var hs-var">fromList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1086"></span><span class="annot"><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679159497"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159497"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159497"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1087"></span><span class="annot"><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159496"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159496"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159495"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159495"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall {a}. Ord a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621679159494"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159496"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159495"><span class="hs-identifier hs-var">xs0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; Set a
forall {t :: * -&gt; *} {a}.
(Foldable t, Ord a) =&gt;
Set a -&gt; t a -&gt; Set a
</span><a href="#local-6989586621679159493"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159496"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159495"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1088"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; [a] -&gt; Set a
forall {a} {t}.
(Ord a, Num t, Bits t) =&gt;
t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159492"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159496"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159495"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1089"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1090"></span><span>    </span><span id="local-6989586621679159494"><span class="annot"><span class="annottext">not_ordered :: a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621679159494"><span class="hs-identifier hs-var hs-var">not_ordered</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1091"></span><span>    </span><span class="annot"><a href="#local-6989586621679159494"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span id="local-6989586621679159489"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159489"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159488"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159488"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159489"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159488"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1092"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679159494"><span class="hs-pragma hs-type">not_ordered</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1093"></span><span>
</span><span id="line-1094"></span><span>    </span><span id="local-6989586621679159493"><span class="annot"><span class="annottext">fromList' :: Set a -&gt; t a -&gt; Set a
</span><a href="#local-6989586621679159493"><span class="hs-identifier hs-var hs-var">fromList'</span></a></span></span><span> </span><span id="local-6989586621679159483"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159483"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span id="local-6989586621679159482"><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621679159482"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Set a -&gt; a -&gt; Set a) -&gt; Set a -&gt; t a -&gt; Set a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; a -&gt; Set a
forall {a}. Ord a =&gt; Set a -&gt; a -&gt; Set a
</span><a href="#local-6989586621679159481"><span class="hs-identifier hs-var">ins</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159483"><span class="hs-identifier hs-var">t0</span></a></span><span> </span><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621679159482"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1095"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679159481"><span class="annot"><span class="annottext">ins :: Set a -&gt; a -&gt; Set a
</span><a href="#local-6989586621679159481"><span class="hs-identifier hs-var hs-var">ins</span></a></span></span><span> </span><span id="local-6989586621679159478"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159478"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679159477"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159477"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. Ord a =&gt; a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159477"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159478"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1096"></span><span>
</span><span id="line-1097"></span><span>    </span><span id="local-6989586621679159492"><span class="annot"><span class="annottext">go :: t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159492"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159464"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159464"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159464"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1098"></span><span>    </span><span class="annot"><a href="#local-6989586621679159492"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159463"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159463"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679159462"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159462"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159462"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159463"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1099"></span><span>    </span><span class="annot"><a href="#local-6989586621679159492"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159460"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159460"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159459"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159459"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159458"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679159458"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679159457"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159457"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159456"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159456"><span class="hs-identifier hs-var">xss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall {a}. Ord a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621679159494"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159457"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159456"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; Set a
forall {t :: * -&gt; *} {a}.
(Foldable t, Ord a) =&gt;
Set a -&gt; t a -&gt; Set a
</span><a href="#local-6989586621679159493"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159459"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159458"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1100"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; (Set a, [a], [a])
forall {a} {a}.
(Num a, Ord a, Bits a) =&gt;
a -&gt; [a] -&gt; (Set a, [a], [a])
</span><a href="#local-6989586621679159455"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159460"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159456"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1101"></span><span>                            </span><span class="hs-special">(</span><span id="local-6989586621679159454"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159454"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159453"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159453"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159492"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159460"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Int -&gt; t
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159457"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159459"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159454"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159453"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1102"></span><span>                            </span><span class="hs-special">(</span><span id="local-6989586621679159452"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159452"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621679159451"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159451"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; Set a
forall {t :: * -&gt; *} {a}.
(Foldable t, Ord a) =&gt;
Set a -&gt; t a -&gt; Set a
</span><a href="#local-6989586621679159493"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159457"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159459"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159452"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159451"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1103"></span><span>
</span><span id="line-1104"></span><span>    </span><span class="hs-comment">-- The create is returning a triple (tree, xs, ys). Both xs and ys</span><span>
</span><span id="line-1105"></span><span>    </span><span class="hs-comment">-- represent not yet processed elements and only one of them can be nonempty.</span><span>
</span><span id="line-1106"></span><span>    </span><span class="hs-comment">-- If ys is nonempty, the keys in ys are not ordered with respect to tree</span><span>
</span><span id="line-1107"></span><span>    </span><span class="hs-comment">-- and must be inserted using fromList'. Otherwise the keys have been</span><span>
</span><span id="line-1108"></span><span>    </span><span class="hs-comment">-- ordered so far.</span><span>
</span><span id="line-1109"></span><span>    </span><span id="local-6989586621679159455"><span class="annot"><span class="annottext">create :: a -&gt; [a] -&gt; (Set a, [a], [a])
</span><a href="#local-6989586621679159455"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1110"></span><span>    </span><span class="annot"><a href="#local-6989586621679159455"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679159439"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159439"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159438"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679159438"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679159437"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159437"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159436"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159436"><span class="hs-identifier hs-var">xss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1111"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159439"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall {a}. Ord a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621679159494"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159437"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159436"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159437"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159436"><span class="hs-identifier hs-var">xss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1112"></span><span>                                      </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159437"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159436"><span class="hs-identifier hs-var">xss</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1113"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; (Set a, [a], [a])
</span><a href="#local-6989586621679159455"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159439"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159438"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1114"></span><span>                      </span><span id="local-6989586621679159435"><span class="annot"><span class="annottext">res :: (Set a, [a], [a])
</span><a href="#local-6989586621679159435"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Set a, [a], [a])
</span><a href="#local-6989586621679159435"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1115"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679159434"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159434"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621679159433"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159433"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159432"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159432"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159433"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159434"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159432"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1116"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679159431"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159431"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159430"><span class="annot"><span class="annottext">ys :: [a]
</span><a href="#local-6989586621679159430"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679159429"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159429"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679159428"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159428"><span class="hs-identifier hs-var">yss</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall {a}. Ord a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="#local-6989586621679159494"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159429"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159428"><span class="hs-identifier hs-var">yss</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159431"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159430"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1117"></span><span>                                         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; (Set a, [a], [a])
</span><a href="#local-6989586621679159455"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159439"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159428"><span class="hs-identifier hs-var">yss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1118"></span><span>                                                   </span><span class="hs-special">(</span><span id="local-6989586621679159427"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159427"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159426"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159426"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159425"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159425"><span class="hs-identifier hs-var">ws</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159429"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159431"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159427"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159426"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159425"><span class="hs-identifier hs-var">ws</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromList"><span class="hs-pragma hs-type">fromList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1123"></span><span class="hs-comment">{--------------------------------------------------------------------
  Building trees from ascending/descending lists can be done in linear time.

  Note that if [xs] is ascending that:
    fromAscList xs == fromList xs
--------------------------------------------------------------------}</span><span>
</span><span id="line-1129"></span><span class="hs-comment">-- | /O(n)/. Build a set from an ascending list in linear time.</span><span>
</span><span id="line-1130"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1131"></span><span id="local-6989586621679160444"><span class="annot"><a href="Data.Set.Internal.html#fromAscList"><span class="hs-identifier hs-type">fromAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679160444"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679160444"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160444"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1132"></span><span id="fromAscList"><span class="annot"><span class="annottext">fromAscList :: forall a. Eq a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromAscList"><span class="hs-identifier hs-var hs-var">fromAscList</span></a></span></span><span> </span><span id="local-6989586621679159422"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159422"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var">fromDistinctAscList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="Data.Set.Internal.html#combineEq"><span class="hs-identifier hs-var">combineEq</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159422"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromAscList"><span class="hs-pragma hs-type">fromAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1137"></span><span class="hs-comment">-- | /O(n)/. Build a set from a descending list in linear time.</span><span>
</span><span id="line-1138"></span><span class="hs-comment">-- /The precondition (input list is descending) is not checked./</span><span>
</span><span id="line-1139"></span><span class="hs-comment">--</span><span>
</span><span id="line-1140"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1141"></span><span id="local-6989586621679159420"><span class="annot"><a href="Data.Set.Internal.html#fromDescList"><span class="hs-identifier hs-type">fromDescList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679159420"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159420"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159420"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1142"></span><span id="fromDescList"><span class="annot"><span class="annottext">fromDescList :: forall a. Eq a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromDescList"><span class="hs-identifier hs-var hs-var">fromDescList</span></a></span></span><span> </span><span id="local-6989586621679159417"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159417"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var">fromDistinctDescList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="Data.Set.Internal.html#combineEq"><span class="hs-identifier hs-var">combineEq</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159417"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#fromDescList"><span class="hs-pragma hs-type">fromDescList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1147"></span><span class="hs-comment">-- [combineEq xs] combines equal elements with [const] in an ordered list [xs]</span><span>
</span><span id="line-1148"></span><span class="hs-comment">--</span><span>
</span><span id="line-1149"></span><span class="hs-comment">-- TODO: combineEq allocates an intermediate list. It *should* be better to</span><span>
</span><span id="line-1150"></span><span class="hs-comment">-- make fromAscListBy and fromDescListBy the fundamental operations, and to</span><span>
</span><span id="line-1151"></span><span class="hs-comment">-- implement the rest using those.</span><span>
</span><span id="line-1152"></span><span id="local-6989586621679160441"><span class="annot"><a href="Data.Set.Internal.html#combineEq"><span class="hs-identifier hs-type">combineEq</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679160441"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679160441"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679160441"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1153"></span><span id="combineEq"><span class="annot"><span class="annottext">combineEq :: forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="Data.Set.Internal.html#combineEq"><span class="hs-identifier hs-var hs-var">combineEq</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1154"></span><span class="annot"><a href="Data.Set.Internal.html#combineEq"><span class="hs-identifier hs-var">combineEq</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159414"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159414"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159413"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159413"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {a}. Eq a =&gt; a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679159412"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159414"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159413"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1155"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1156"></span><span>    </span><span id="local-6989586621679159412"><span class="annot"><span class="annottext">combineEq' :: a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679159412"><span class="hs-identifier hs-var hs-var">combineEq'</span></a></span></span><span> </span><span id="local-6989586621679159409"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159409"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159409"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1157"></span><span>    </span><span class="annot"><a href="#local-6989586621679159412"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span id="local-6989586621679159408"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159408"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159407"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159407"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679159406"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159406"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1158"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159408"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159407"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679159412"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159408"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159406"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1159"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159408"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679159412"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159407"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159406"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1160"></span><span>
</span><span id="line-1161"></span><span class="hs-comment">-- | /O(n)/. Build a set from an ascending list of distinct elements in linear time.</span><span>
</span><span id="line-1162"></span><span class="hs-comment">-- /The precondition (input list is strictly ascending) is not checked./</span><span>
</span><span id="line-1163"></span><span>
</span><span id="line-1164"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromDistinctAscList or in</span><span>
</span><span id="line-1165"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1166"></span><span id="local-6989586621679160442"><span class="annot"><a href="Data.Set.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-type">fromDistinctAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679160442"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160442"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1167"></span><span id="fromDistinctAscList"><span class="annot"><span class="annottext">fromDistinctAscList :: forall a. [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var hs-var">fromDistinctAscList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1168"></span><span class="annot"><a href="Data.Set.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var">fromDistinctAscList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159403"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159403"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159402"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159402"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; [a] -&gt; Set a
forall {t} {a}. (Num t, Bits t) =&gt; t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159401"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159403"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159402"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1169"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1170"></span><span>    </span><span id="local-6989586621679159401"><span class="annot"><span class="annottext">go :: t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159401"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159395"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159395"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159395"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1171"></span><span>    </span><span class="annot"><a href="#local-6989586621679159401"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159394"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159394"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159393"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159393"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159392"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159392"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159391"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159391"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; StrictPair (Set a) [a]
forall {a} {a}.
(Num a, Bits a) =&gt;
a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159390"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159394"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159391"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1172"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679159389"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159389"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159388"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159388"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159387"><span class="annot"><span class="annottext">t' :: Set a
</span><a href="#local-6989586621679159387"><span class="hs-identifier hs-var hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159392"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159393"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159389"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1173"></span><span>                                      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159401"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159394"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Int -&gt; t
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159387"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159388"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1174"></span><span>
</span><span id="line-1175"></span><span>    </span><span id="local-6989586621679159390"><span class="annot"><span class="annottext">create :: a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159390"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1176"></span><span>    </span><span class="annot"><a href="#local-6989586621679159390"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679159379"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159379"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159378"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679159378"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679159377"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159377"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159376"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159376"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1177"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159379"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159377"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159376"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1178"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159390"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159379"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159378"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1179"></span><span>                      </span><span id="local-6989586621679159375"><span class="annot"><span class="annottext">res :: StrictPair (Set a) [a]
</span><a href="#local-6989586621679159375"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) [a]
</span><a href="#local-6989586621679159375"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1180"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679159374"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159374"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159373"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159373"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679159372"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159372"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159390"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159379"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159372"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1181"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679159371"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159371"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159370"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159370"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159373"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159374"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159371"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159370"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1182"></span><span>
</span><span id="line-1183"></span><span class="hs-comment">-- | /O(n)/. Build a set from a descending list of distinct elements in linear time.</span><span>
</span><span id="line-1184"></span><span class="hs-comment">-- /The precondition (input list is strictly descending) is not checked./</span><span>
</span><span id="line-1185"></span><span>
</span><span id="line-1186"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromDistinctDescList or in</span><span>
</span><span id="line-1187"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1188"></span><span class="hs-comment">--</span><span>
</span><span id="line-1189"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1190"></span><span id="local-6989586621679159369"><span class="annot"><a href="Data.Set.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-type">fromDistinctDescList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679159369"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159369"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1191"></span><span id="fromDistinctDescList"><span class="annot"><span class="annottext">fromDistinctDescList :: forall a. [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var hs-var">fromDistinctDescList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1192"></span><span class="annot"><a href="Data.Set.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var">fromDistinctDescList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159366"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159366"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159365"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159365"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; [a] -&gt; Set a
forall {t} {a}. (Num t, Bits t) =&gt; t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159364"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159366"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159365"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1193"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1194"></span><span>    </span><span id="local-6989586621679159364"><span class="annot"><span class="annottext">go :: t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159364"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159358"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159358"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159358"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1195"></span><span>    </span><span class="annot"><a href="#local-6989586621679159364"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159357"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159357"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159356"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159356"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159355"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159355"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159354"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159354"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [a] -&gt; StrictPair (Set a) [a]
forall {a} {a}.
(Num a, Bits a) =&gt;
a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159353"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159357"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159354"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1196"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679159352"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159352"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159351"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159351"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159350"><span class="annot"><span class="annottext">t' :: Set a
</span><a href="#local-6989586621679159350"><span class="hs-identifier hs-var hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159355"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159352"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159356"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1197"></span><span>                                      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set a -&gt; [a] -&gt; Set a
</span><a href="#local-6989586621679159364"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679159357"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Int -&gt; t
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159350"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159351"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1198"></span><span>
</span><span id="line-1199"></span><span>    </span><span id="local-6989586621679159353"><span class="annot"><span class="annottext">create :: a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159353"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1200"></span><span>    </span><span class="annot"><a href="#local-6989586621679159353"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679159342"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159342"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679159341"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679159341"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679159340"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159340"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679159339"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159339"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1201"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159342"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159340"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159339"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1202"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159353"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159342"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159341"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1203"></span><span>                      </span><span id="local-6989586621679159338"><span class="annot"><span class="annottext">res :: StrictPair (Set a) [a]
</span><a href="#local-6989586621679159338"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) [a]
</span><a href="#local-6989586621679159338"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1204"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679159337"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159337"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159336"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159336"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679159335"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159335"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; StrictPair (Set a) [a]
</span><a href="#local-6989586621679159353"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159342"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159335"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1205"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679159334"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159334"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159333"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159333"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159336"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159334"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159337"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a] -&gt; StrictPair (Set a) [a]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159333"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span>
</span><span id="line-1207"></span><span class="hs-comment">{--------------------------------------------------------------------
  Eq converts the set to a list. In a lazy setting, this
  actually seems one of the faster methods to compare two trees
  and it is certainly the simplest :-)
--------------------------------------------------------------------}</span><span>
</span><span id="line-1212"></span><span id="local-6989586621679160427"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159330"><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679160427"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160427"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1213"></span><span>  </span><span id="local-6989586621679159325"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159325"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621679159324"><span class="annot"><span class="annottext">== :: Set a -&gt; Set a -&gt; Bool
</span><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></span></span><span> </span><span id="local-6989586621679159323"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159323"><span class="hs-identifier hs-var">t2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159325"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159323"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159325"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159323"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1214"></span><span>
</span><span id="line-1215"></span><span class="hs-comment">{--------------------------------------------------------------------
  Ord
--------------------------------------------------------------------}</span><span>
</span><span id="line-1218"></span><span>
</span><span id="line-1219"></span><span id="local-6989586621679160425"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159308"><span id="local-6989586621679159310"><span id="local-6989586621679159312"><span id="local-6989586621679159314"><span id="local-6989586621679159316"><span id="local-6989586621679159318"><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160425"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160425"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1220"></span><span>    </span><span id="local-6989586621679159304"><span class="annot"><span class="annottext">compare :: Set a -&gt; Set a -&gt; Ordering
</span><a href="#local-6989586621679159304"><span class="hs-identifier hs-var hs-var hs-var hs-var">compare</span></a></span></span><span> </span><span id="local-6989586621679159303"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159303"><span class="hs-identifier hs-var">s1</span></a></span></span><span> </span><span id="local-6989586621679159302"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159302"><span class="hs-identifier hs-var">s2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159303"><span class="hs-identifier hs-var">s1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toAscList"><span class="hs-identifier hs-var">toAscList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159302"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1221"></span><span>
</span><span id="line-1222"></span><span class="hs-comment">{--------------------------------------------------------------------
  Show
--------------------------------------------------------------------}</span><span>
</span><span id="line-1225"></span><span id="local-6989586621679160421"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159297"><span id="local-6989586621679159299"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160421"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160421"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1226"></span><span>  </span><span id="local-6989586621679159291"><span class="annot"><span class="annottext">showsPrec :: Int -&gt; Set a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">showsPrec</span></a></span></span><span> </span><span id="local-6989586621679159289"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159289"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679159288"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159288"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; ShowS -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showParen"><span class="hs-identifier hs-var">showParen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159289"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ShowS -&gt; ShowS) -&gt; ShowS -&gt; ShowS
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1227"></span><span>    </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;fromList &quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159288"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span></span><span class="hs-cpp">

#if MIN_VERSION_base(4,9,0)
</span><span class="hs-comment">-- | @since 0.5.9</span><span>
</span><span id="line-1231"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Classes.html#Eq1"><span class="hs-identifier hs-type">Eq1</span></a></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1232"></span><span>    </span><span id="local-6989586621679159277"><span class="annot"><span class="annottext">liftEq :: forall a b. (a -&gt; b -&gt; Bool) -&gt; Set a -&gt; Set b -&gt; Bool
</span><a href="../../base/src/Data.Functor.Classes.html#liftEq"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftEq</span></a></span></span><span> </span><span id="local-6989586621679159275"><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><a href="#local-6989586621679159275"><span class="hs-identifier hs-var">eq</span></a></span></span><span> </span><span id="local-6989586621679159274"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159274"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679159273"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159273"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1233"></span><span>        </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159274"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Set b -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159273"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; Bool) -&gt; [a] -&gt; [b] -&gt; Bool
forall (f :: * -&gt; *) a b.
Eq1 f =&gt;
(a -&gt; b -&gt; Bool) -&gt; f a -&gt; f b -&gt; Bool
</span><a href="../../base/src/Data.Functor.Classes.html#liftEq"><span class="hs-identifier hs-var">liftEq</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
</span><a href="#local-6989586621679159275"><span class="hs-identifier hs-var">eq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159274"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set b -&gt; [b]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159273"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1234"></span><span>
</span><span id="line-1235"></span><span class="hs-comment">-- | @since 0.5.9</span><span>
</span><span id="line-1236"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Classes.html#Ord1"><span class="hs-identifier hs-type">Ord1</span></a></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1237"></span><span>    </span><span id="local-6989586621679159265"><span class="annot"><span class="annottext">liftCompare :: forall a b. (a -&gt; b -&gt; Ordering) -&gt; Set a -&gt; Set b -&gt; Ordering
</span><a href="../../base/src/Data.Functor.Classes.html#liftCompare"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftCompare</span></a></span></span><span> </span><span id="local-6989586621679159263"><span class="annot"><span class="annottext">a -&gt; b -&gt; Ordering
</span><a href="#local-6989586621679159263"><span class="hs-identifier hs-var">cmp</span></a></span></span><span> </span><span id="local-6989586621679159262"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159262"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679159261"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159261"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1238"></span><span>        </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; Ordering) -&gt; [a] -&gt; [b] -&gt; Ordering
forall (f :: * -&gt; *) a b.
Ord1 f =&gt;
(a -&gt; b -&gt; Ordering) -&gt; f a -&gt; f b -&gt; Ordering
</span><a href="../../base/src/Data.Functor.Classes.html#liftCompare"><span class="hs-identifier hs-var">liftCompare</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Ordering
</span><a href="#local-6989586621679159263"><span class="hs-identifier hs-var">cmp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159262"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set b -&gt; [b]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679159261"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1239"></span><span>
</span><span id="line-1240"></span><span class="hs-comment">-- | @since 0.5.9</span><span>
</span><span id="line-1241"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159258"><span class="annot"><a href="../../base/src/Data.Functor.Classes.html#Show1"><span class="hs-identifier hs-type">Show1</span></a></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1242"></span><span>    </span><span id="local-6989586621679159254"><span class="annot"><span class="annottext">liftShowsPrec :: forall a.
(Int -&gt; a -&gt; ShowS) -&gt; ([a] -&gt; ShowS) -&gt; Int -&gt; Set a -&gt; ShowS
</span><a href="../../base/src/Data.Functor.Classes.html#liftShowsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftShowsPrec</span></a></span></span><span> </span><span id="local-6989586621679159252"><span class="annot"><span class="annottext">Int -&gt; a -&gt; ShowS
</span><a href="#local-6989586621679159252"><span class="hs-identifier hs-var">sp</span></a></span></span><span> </span><span id="local-6989586621679159251"><span class="annot"><span class="annottext">[a] -&gt; ShowS
</span><a href="#local-6989586621679159251"><span class="hs-identifier hs-var">sl</span></a></span></span><span> </span><span id="local-6989586621679159250"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159250"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span id="local-6989586621679159249"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159249"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1243"></span><span>        </span><span class="annot"><span class="annottext">(Int -&gt; [a] -&gt; ShowS) -&gt; [Char] -&gt; Int -&gt; [a] -&gt; ShowS
forall a. (Int -&gt; a -&gt; ShowS) -&gt; [Char] -&gt; Int -&gt; a -&gt; ShowS
</span><a href="../../base/src/Data.Functor.Classes.html#showsUnaryWith"><span class="hs-identifier hs-var">showsUnaryWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Int -&gt; a -&gt; ShowS) -&gt; ([a] -&gt; ShowS) -&gt; Int -&gt; [a] -&gt; ShowS
forall (f :: * -&gt; *) a.
Show1 f =&gt;
(Int -&gt; a -&gt; ShowS) -&gt; ([a] -&gt; ShowS) -&gt; Int -&gt; f a -&gt; ShowS
</span><a href="../../base/src/Data.Functor.Classes.html#liftShowsPrec"><span class="hs-identifier hs-var">liftShowsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; ShowS
</span><a href="#local-6989586621679159252"><span class="hs-identifier hs-var">sp</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; ShowS
</span><a href="#local-6989586621679159251"><span class="hs-identifier hs-var">sl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;fromList&quot;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159250"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; [a]
forall a. Set a -&gt; [a]
</span><a href="Data.Set.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159249"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1246"></span><span class="hs-comment">{--------------------------------------------------------------------
  Read
--------------------------------------------------------------------}</span><span>
</span><span id="line-1249"></span><span id="local-6989586621679160398"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679159244"><span id="local-6989586621679159246"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier hs-type">Read</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160398"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160398"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier hs-type">Read</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160398"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">
#ifdef __GLASGOW_HASKELL__
</span><span>  </span><span id="local-6989586621679159231"><span class="annot"><span class="annottext">readPrec :: ReadPrec (Set a)
</span><a href="#local-6989586621679159231"><span class="hs-identifier hs-var hs-var hs-var hs-var">readPrec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ReadPrec (Set a) -&gt; ReadPrec (Set a)
forall a. ReadPrec a -&gt; ReadPrec a
</span><a href="../../base/src/GHC.Read.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="annot"><span class="annottext">(ReadPrec (Set a) -&gt; ReadPrec (Set a))
-&gt; ReadPrec (Set a) -&gt; ReadPrec (Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ReadPrec (Set a) -&gt; ReadPrec (Set a)
forall a. Int -&gt; ReadPrec a -&gt; ReadPrec a
</span><a href="../../base/src/Text.ParserCombinators.ReadPrec.html#prec"><span class="hs-identifier hs-var">prec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">(ReadPrec (Set a) -&gt; ReadPrec (Set a))
-&gt; ReadPrec (Set a) -&gt; ReadPrec (Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1252"></span><span>    </span><span class="annot"><a href="../../base/src/Text.Read.Lex.html#Ident"><span class="hs-identifier hs-type">Ident</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;fromList&quot;</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadPrec Lexeme
</span><a href="../../base/src/GHC.Read.html#lexP"><span class="hs-identifier hs-var">lexP</span></a></span><span>
</span><span id="line-1253"></span><span>    </span><span id="local-6989586621679159229"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159229"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadPrec [a]
forall a. Read a =&gt; ReadPrec a
</span><a href="../../base/src/GHC.Read.html#readPrec"><span class="hs-identifier hs-var">readPrec</span></a></span><span>
</span><span id="line-1254"></span><span>    </span><span class="annot"><span class="annottext">Set a -&gt; ReadPrec (Set a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Set a
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679159229"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1255"></span><span>
</span><span id="line-1256"></span><span>  </span><span id="local-6989586621679159227"><span class="annot"><span class="annottext">readListPrec :: ReadPrec [Set a]
</span><a href="../../base/src/GHC.Read.html#readListPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">readListPrec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ReadPrec [Set a]
forall a. Read a =&gt; ReadPrec [a]
</span><a href="../../base/src/GHC.Read.html#readListPrecDefault"><span class="hs-identifier hs-var">readListPrecDefault</span></a></span></span><span class="hs-cpp">
#else
</span><span>  </span><span class="hs-identifier">readsPrec</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">readParen</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">p</span><span> </span><span class="hs-operator">&gt;</span><span> </span><span class="hs-number">10</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1259"></span><span>    </span><span class="hs-special">(</span><span class="hs-string">&quot;fromList&quot;</span><span class="hs-special">,</span><span class="hs-identifier">s</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">lex</span><span> </span><span class="hs-identifier">r</span><span>
</span><span id="line-1260"></span><span>    </span><span class="hs-special">(</span><span class="hs-identifier">xs</span><span class="hs-special">,</span><span class="hs-identifier">t</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">reads</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-1261"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromList</span><span> </span><span class="hs-identifier">xs</span><span class="hs-special">,</span><span class="hs-identifier">t</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1264"></span><span class="hs-comment">{--------------------------------------------------------------------
  Typeable/Data
--------------------------------------------------------------------}</span><span>
</span><span id="line-1267"></span><span>
</span><span id="line-1268"></span><span class="hs-identifier">INSTANCE_TYPEABLE1</span><span class="hs-special">(</span><span class="hs-identifier">Set</span><span class="hs-special">)</span><span>
</span><span id="line-1269"></span><span>
</span><span id="line-1270"></span><span class="hs-comment">{--------------------------------------------------------------------
  NFData
--------------------------------------------------------------------}</span><span>
</span><span id="line-1273"></span><span>
</span><span id="line-1274"></span><span id="local-6989586621679160387"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160387"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160387"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1275"></span><span>    </span><span id="local-6989586621679159218"><span class="annot"><span class="annottext">rnf :: Set a -&gt; ()
</span><a href="#local-6989586621679159218"><span class="hs-identifier hs-var hs-var hs-var hs-var">rnf</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1276"></span><span>    </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var">rnf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159217"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159217"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159216"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159216"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159215"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159215"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ()
forall a. NFData a =&gt; a -&gt; ()
</span><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var">rnf</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159217"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; ()
forall a. NFData a =&gt; a -&gt; ()
</span><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var">rnf</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159216"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; ()
forall a. NFData a =&gt; a -&gt; ()
</span><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var">rnf</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159215"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1277"></span><span>
</span><span id="line-1278"></span><span class="hs-comment">{--------------------------------------------------------------------
  Split
--------------------------------------------------------------------}</span><span>
</span><span id="line-1281"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'split' x set@) is a pair @(set1,set2)@</span><span>
</span><span id="line-1282"></span><span class="hs-comment">-- where @set1@ comprises the elements of @set@ less than @x@ and @set2@</span><span>
</span><span id="line-1283"></span><span class="hs-comment">-- comprises the elements of @set@ greater than @x@.</span><span>
</span><span id="line-1284"></span><span id="local-6989586621679160504"><span class="annot"><a href="Data.Set.Internal.html#split"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160504"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160504"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160504"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160504"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160504"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1285"></span><span id="split"><span class="annot"><span class="annottext">split :: forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Set a)
</span><a href="Data.Set.Internal.html#split"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span id="local-6989586621679159212"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159212"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159211"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159211"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Set a) (Set a) -&gt; (Set a, Set a))
-&gt; StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var">splitS</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159212"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159211"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1286"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#split"><span class="hs-pragma hs-type">split</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1287"></span><span>
</span><span id="line-1288"></span><span id="local-6989586621679160506"><span class="annot"><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-type">splitS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160506"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160506"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160506"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160506"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160506"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1289"></span><span id="splitS"><span class="annot"><span class="annottext">splitS :: forall a. Ord a =&gt; a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var hs-var">splitS</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1290"></span><span class="annot"><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var">splitS</span></a></span><span> </span><span id="local-6989586621679159206"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159206"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159205"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159205"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159204"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159204"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159203"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159203"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1291"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159206"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159205"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1292"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159202"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159202"><span class="hs-identifier hs-var">lt</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159201"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159201"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var">splitS</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159206"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159204"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159202"><span class="hs-identifier hs-var">lt</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159205"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159201"><span class="hs-identifier hs-var">gt</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159203"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1293"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159200"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159200"><span class="hs-identifier hs-var">lt</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159199"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159199"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="Data.Set.Internal.html#splitS"><span class="hs-identifier hs-var">splitS</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159206"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159203"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159205"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159204"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159200"><span class="hs-identifier hs-var">lt</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159199"><span class="hs-identifier hs-var">gt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1294"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159204"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159203"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1295"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitS"><span class="hs-pragma hs-type">splitS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1296"></span><span>
</span><span id="line-1297"></span><span class="hs-comment">-- | /O(log n)/. Performs a 'split' but also returns whether the pivot</span><span>
</span><span id="line-1298"></span><span class="hs-comment">-- element was found in the original set.</span><span>
</span><span id="line-1299"></span><span id="local-6989586621679160523"><span class="annot"><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-type">splitMember</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160523"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160523"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1300"></span><span id="splitMember"><span class="annot"><span class="annottext">splitMember :: forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var hs-var">splitMember</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1301"></span><span class="annot"><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span id="local-6989586621679159194"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159194"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159193"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159193"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159192"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159192"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159191"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159191"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1302"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159194"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159193"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1303"></span><span>       </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159190"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159190"><span class="hs-identifier hs-var">lt</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159189"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159189"><span class="hs-identifier hs-var">found</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159188"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159188"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Bool, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159194"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159192"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1304"></span><span>                 </span><span class="hs-glyph">!</span><span id="local-6989586621679159187"><span class="annot"><span class="annottext">gt' :: Set a
</span><a href="#local-6989586621679159187"><span class="hs-identifier hs-var hs-var">gt'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159193"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159188"><span class="hs-identifier hs-var">gt</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159191"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1305"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159190"><span class="hs-identifier hs-var">lt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159189"><span class="hs-identifier hs-var">found</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159187"><span class="hs-identifier hs-var">gt'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1306"></span><span>       </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679159186"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159186"><span class="hs-identifier hs-var">lt</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159185"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159185"><span class="hs-identifier hs-var">found</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679159184"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159184"><span class="hs-identifier hs-var">gt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; (Set a, Bool, Set a)
forall a. Ord a =&gt; a -&gt; Set a -&gt; (Set a, Bool, Set a)
</span><a href="Data.Set.Internal.html#splitMember"><span class="hs-identifier hs-var">splitMember</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159194"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159191"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1307"></span><span>                 </span><span class="hs-glyph">!</span><span id="local-6989586621679159183"><span class="annot"><span class="annottext">lt' :: Set a
</span><a href="#local-6989586621679159183"><span class="hs-identifier hs-var hs-var">lt'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159193"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159192"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159186"><span class="hs-identifier hs-var">lt</span></a></span><span>
</span><span id="line-1308"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159183"><span class="hs-identifier hs-var">lt'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679159185"><span class="hs-identifier hs-var">found</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159184"><span class="hs-identifier hs-var">gt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1309"></span><span>       </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159192"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159191"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitMember"><span class="hs-pragma hs-type">splitMember</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1314"></span><span class="hs-comment">{--------------------------------------------------------------------
  Indexing
--------------------------------------------------------------------}</span><span>
</span><span id="line-1317"></span><span>
</span><span id="line-1318"></span><span class="hs-comment">-- | /O(log n)/. Return the /index/ of an element, which is its zero-based</span><span>
</span><span id="line-1319"></span><span class="hs-comment">-- index in the sorted sequence of elements. The index is a number from /0/ up</span><span>
</span><span id="line-1320"></span><span class="hs-comment">-- to, but not including, the 'size' of the set. Calls 'error' when the element</span><span>
</span><span id="line-1321"></span><span class="hs-comment">-- is not a 'member' of the set.</span><span>
</span><span id="line-1322"></span><span class="hs-comment">--</span><span>
</span><span id="line-1323"></span><span class="hs-comment">-- &gt; findIndex 2 (fromList [5,3])    Error: element is not in the set</span><span>
</span><span id="line-1324"></span><span class="hs-comment">-- &gt; findIndex 3 (fromList [5,3]) == 0</span><span>
</span><span id="line-1325"></span><span class="hs-comment">-- &gt; findIndex 5 (fromList [5,3]) == 1</span><span>
</span><span id="line-1326"></span><span class="hs-comment">-- &gt; findIndex 6 (fromList [5,3])    Error: element is not in the set</span><span>
</span><span id="line-1327"></span><span class="hs-comment">--</span><span>
</span><span id="line-1328"></span><span class="hs-comment">-- @since 0.5.4</span><span>
</span><span id="line-1329"></span><span>
</span><span id="line-1330"></span><span class="hs-comment">-- See Note: Type of local 'go' function</span><span>
</span><span id="line-1331"></span><span id="local-6989586621679160383"><span class="annot"><a href="Data.Set.Internal.html#findIndex"><span class="hs-identifier hs-type">findIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160383"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160383"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160383"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-1332"></span><span id="findIndex"><span class="annot"><span class="annottext">findIndex :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Int
</span><a href="Data.Set.Internal.html#findIndex"><span class="hs-identifier hs-var hs-var">findIndex</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Int
</span><a href="#local-6989586621679159180"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1333"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1334"></span><span>    </span><span id="local-6989586621679160381"><span class="annot"><a href="#local-6989586621679159180"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160381"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160381"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160381"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-1335"></span><span>    </span><span id="local-6989586621679159180"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Int
</span><a href="#local-6989586621679159180"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Int
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.findIndex: element is not in the set&quot;</span></span><span>
</span><span id="line-1336"></span><span>    </span><span class="annot"><a href="#local-6989586621679159180"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159169"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159169"><span class="hs-identifier hs-var">idx</span></a></span></span><span> </span><span id="local-6989586621679159168"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159168"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159167"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159167"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679159166"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159166"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159165"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159165"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159168"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159167"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1337"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Int
</span><a href="#local-6989586621679159180"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159169"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159168"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159166"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1338"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Int
</span><a href="#local-6989586621679159180"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159169"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159166"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159168"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159165"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1339"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159169"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159166"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#findIndex"><span class="hs-pragma hs-type">findIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1344"></span><span class="hs-comment">-- | /O(log n)/. Lookup the /index/ of an element, which is its zero-based index in</span><span>
</span><span id="line-1345"></span><span class="hs-comment">-- the sorted sequence of elements. The index is a number from /0/ up to, but not</span><span>
</span><span id="line-1346"></span><span class="hs-comment">-- including, the 'size' of the set.</span><span>
</span><span id="line-1347"></span><span class="hs-comment">--</span><span>
</span><span id="line-1348"></span><span class="hs-comment">-- &gt; isJust   (lookupIndex 2 (fromList [5,3])) == False</span><span>
</span><span id="line-1349"></span><span class="hs-comment">-- &gt; fromJust (lookupIndex 3 (fromList [5,3])) == 0</span><span>
</span><span id="line-1350"></span><span class="hs-comment">-- &gt; fromJust (lookupIndex 5 (fromList [5,3])) == 1</span><span>
</span><span id="line-1351"></span><span class="hs-comment">-- &gt; isJust   (lookupIndex 6 (fromList [5,3])) == False</span><span>
</span><span id="line-1352"></span><span class="hs-comment">--</span><span>
</span><span id="line-1353"></span><span class="hs-comment">-- @since 0.5.4</span><span>
</span><span id="line-1354"></span><span>
</span><span id="line-1355"></span><span class="hs-comment">-- See Note: Type of local 'go' function</span><span>
</span><span id="line-1356"></span><span id="local-6989586621679160379"><span class="annot"><a href="Data.Set.Internal.html#lookupIndex"><span class="hs-identifier hs-type">lookupIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160379"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160379"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160379"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-1357"></span><span id="lookupIndex"><span class="annot"><span class="annottext">lookupIndex :: forall a. Ord a =&gt; a -&gt; Set a -&gt; Maybe Int
</span><a href="Data.Set.Internal.html#lookupIndex"><span class="hs-identifier hs-var hs-var">lookupIndex</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Maybe Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Maybe Int
</span><a href="#local-6989586621679159162"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1358"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1359"></span><span>    </span><span id="local-6989586621679160377"><span class="annot"><a href="#local-6989586621679159162"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160377"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160377"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160377"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-1360"></span><span>    </span><span id="local-6989586621679159162"><span class="annot"><span class="annottext">go :: forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Maybe Int
</span><a href="#local-6989586621679159162"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1361"></span><span>    </span><span class="annot"><a href="#local-6989586621679159162"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159153"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159153"><span class="hs-identifier hs-var">idx</span></a></span></span><span> </span><span id="local-6989586621679159152"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159152"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159151"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159151"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679159150"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159150"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159149"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159149"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159152"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159151"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1362"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Maybe Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Maybe Int
</span><a href="#local-6989586621679159162"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159153"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159152"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159150"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1363"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Maybe Int
forall a. Ord a =&gt; Int -&gt; a -&gt; Set a -&gt; Maybe Int
</span><a href="#local-6989586621679159162"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159153"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159150"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159152"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159149"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1364"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Maybe Int) -&gt; Int -&gt; Maybe Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159153"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159150"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#lookupIndex"><span class="hs-pragma hs-type">lookupIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1369"></span><span class="hs-comment">-- | /O(log n)/. Retrieve an element by its /index/, i.e. by its zero-based</span><span>
</span><span id="line-1370"></span><span class="hs-comment">-- index in the sorted sequence of elements. If the /index/ is out of range (less</span><span>
</span><span id="line-1371"></span><span class="hs-comment">-- than zero, greater or equal to 'size' of the set), 'error' is called.</span><span>
</span><span id="line-1372"></span><span class="hs-comment">--</span><span>
</span><span id="line-1373"></span><span class="hs-comment">-- &gt; elemAt 0 (fromList [5,3]) == 3</span><span>
</span><span id="line-1374"></span><span class="hs-comment">-- &gt; elemAt 1 (fromList [5,3]) == 5</span><span>
</span><span id="line-1375"></span><span class="hs-comment">-- &gt; elemAt 2 (fromList [5,3])    Error: index out of range</span><span>
</span><span id="line-1376"></span><span class="hs-comment">--</span><span>
</span><span id="line-1377"></span><span class="hs-comment">-- @since 0.5.4</span><span>
</span><span id="line-1378"></span><span>
</span><span id="line-1379"></span><span id="local-6989586621679160375"><span class="annot"><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier hs-type">elemAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160375"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679160375"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1380"></span><span id="elemAt"><span class="annot"><span class="annottext">elemAt :: forall a. Int -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier hs-var hs-var">elemAt</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.elemAt: index out of range&quot;</span></span><span>
</span><span id="line-1381"></span><span class="annot"><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier hs-var">elemAt</span></a></span><span> </span><span id="local-6989586621679159142"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159142"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159141"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159141"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159140"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159140"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159139"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159139"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1382"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159142"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159138"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1383"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; a
forall a. Int -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier hs-var">elemAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159142"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159140"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1384"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; a
forall a. Int -&gt; Set a -&gt; a
</span><a href="Data.Set.Internal.html#elemAt"><span class="hs-identifier hs-var">elemAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159142"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159138"><span class="hs-identifier hs-var">sizeL</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159139"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1385"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159141"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1386"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1387"></span><span>    </span><span id="local-6989586621679159138"><span class="annot"><span class="annottext">sizeL :: Int
</span><a href="#local-6989586621679159138"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159140"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1388"></span><span>
</span><span id="line-1389"></span><span class="hs-comment">-- | /O(log n)/. Delete the element at /index/, i.e. by its zero-based index in</span><span>
</span><span id="line-1390"></span><span class="hs-comment">-- the sorted sequence of elements. If the /index/ is out of range (less than zero,</span><span>
</span><span id="line-1391"></span><span class="hs-comment">-- greater or equal to 'size' of the set), 'error' is called.</span><span>
</span><span id="line-1392"></span><span class="hs-comment">--</span><span>
</span><span id="line-1393"></span><span class="hs-comment">-- &gt; deleteAt 0    (fromList [5,3]) == singleton 5</span><span>
</span><span id="line-1394"></span><span class="hs-comment">-- &gt; deleteAt 1    (fromList [5,3]) == singleton 3</span><span>
</span><span id="line-1395"></span><span class="hs-comment">-- &gt; deleteAt 2    (fromList [5,3])    Error: index out of range</span><span>
</span><span id="line-1396"></span><span class="hs-comment">-- &gt; deleteAt (-1) (fromList [5,3])    Error: index out of range</span><span>
</span><span id="line-1397"></span><span class="hs-comment">--</span><span>
</span><span id="line-1398"></span><span class="hs-comment">-- @since 0.5.4</span><span>
</span><span id="line-1399"></span><span>
</span><span id="line-1400"></span><span id="local-6989586621679160373"><span class="annot"><a href="Data.Set.Internal.html#deleteAt"><span class="hs-identifier hs-type">deleteAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160373"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160373"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1401"></span><span id="deleteAt"><span class="annot"><span class="annottext">deleteAt :: forall a. Int -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteAt"><span class="hs-identifier hs-var hs-var">deleteAt</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679159131"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159131"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679159130"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159130"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1402"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159130"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1403"></span><span>    </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Set a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.deleteAt: index out of range&quot;</span></span><span>
</span><span id="line-1404"></span><span>    </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159129"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159129"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159128"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159128"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159127"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159127"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159131"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159126"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1405"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159129"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
forall a. Int -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteAt"><span class="hs-identifier hs-var">deleteAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159131"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159128"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159127"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1406"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159129"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159128"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
forall a. Int -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#deleteAt"><span class="hs-identifier hs-var">deleteAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159131"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159126"><span class="hs-identifier hs-var">sizeL</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159127"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1407"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159128"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159127"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1408"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1409"></span><span>        </span><span id="local-6989586621679159126"><span class="annot"><span class="annottext">sizeL :: Int
</span><a href="#local-6989586621679159126"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159128"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1410"></span><span>
</span><span id="line-1411"></span><span class="hs-comment">-- | Take a given number of elements in order, beginning</span><span>
</span><span id="line-1412"></span><span class="hs-comment">-- with the smallest ones.</span><span>
</span><span id="line-1413"></span><span class="hs-comment">--</span><span>
</span><span id="line-1414"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1415"></span><span class="hs-comment">-- take n = 'fromDistinctAscList' . 'Prelude.take' n . 'toAscList'</span><span>
</span><span id="line-1416"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1417"></span><span class="hs-comment">--</span><span>
</span><span id="line-1418"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1419"></span><span id="local-6989586621679159125"><span class="annot"><a href="Data.Set.Internal.html#take"><span class="hs-identifier hs-type">take</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159125"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159125"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1420"></span><span id="take"><span class="annot"><span class="annottext">take :: forall a. Int -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#take"><span class="hs-identifier hs-var hs-var">take</span></a></span></span><span> </span><span id="local-6989586621679159123"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159123"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679159122"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159122"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159123"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159122"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159122"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1421"></span><span class="annot"><a href="Data.Set.Internal.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span id="local-6989586621679159121"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159121"><span class="hs-identifier hs-var">i0</span></a></span></span><span> </span><span id="local-6989586621679159120"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159120"><span class="hs-identifier hs-var">m0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
forall a. Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159119"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159121"><span class="hs-identifier hs-var">i0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159120"><span class="hs-identifier hs-var">m0</span></a></span><span>
</span><span id="line-1422"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1423"></span><span>    </span><span id="local-6989586621679159119"><span class="annot"><span class="annottext">go :: Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159119"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159112"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159112"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159112"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1424"></span><span>    </span><span class="annot"><a href="#local-6989586621679159119"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1425"></span><span>    </span><span class="annot"><a href="#local-6989586621679159119"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159111"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159111"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159110"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159110"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159109"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159109"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159108"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159108"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1426"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159111"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159107"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1427"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159119"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159111"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159109"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1428"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159110"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159109"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159119"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159111"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159107"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159108"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1429"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159109"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1430"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679159107"><span class="annot"><span class="annottext">sizeL :: Int
</span><a href="#local-6989586621679159107"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159109"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1431"></span><span>
</span><span id="line-1432"></span><span class="hs-comment">-- | Drop a given number of elements in order, beginning</span><span>
</span><span id="line-1433"></span><span class="hs-comment">-- with the smallest ones.</span><span>
</span><span id="line-1434"></span><span class="hs-comment">--</span><span>
</span><span id="line-1435"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1436"></span><span class="hs-comment">-- drop n = 'fromDistinctAscList' . 'Prelude.drop' n . 'toAscList'</span><span>
</span><span id="line-1437"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1438"></span><span class="hs-comment">--</span><span>
</span><span id="line-1439"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1440"></span><span id="local-6989586621679159106"><span class="annot"><a href="Data.Set.Internal.html#drop"><span class="hs-identifier hs-type">drop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159106"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159106"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1441"></span><span id="drop"><span class="annot"><span class="annottext">drop :: forall a. Int -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#drop"><span class="hs-identifier hs-var hs-var">drop</span></a></span></span><span> </span><span id="local-6989586621679159104"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159104"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679159103"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159103"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159104"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159103"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1442"></span><span class="annot"><a href="Data.Set.Internal.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span id="local-6989586621679159102"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159102"><span class="hs-identifier hs-var">i0</span></a></span></span><span> </span><span id="local-6989586621679159101"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159101"><span class="hs-identifier hs-var">m0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
forall a. Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159100"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159102"><span class="hs-identifier hs-var">i0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159101"><span class="hs-identifier hs-var">m0</span></a></span><span>
</span><span id="line-1443"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1444"></span><span>    </span><span id="local-6989586621679159100"><span class="annot"><span class="annottext">go :: Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159100"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159093"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159093"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679159092"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159092"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159093"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159092"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1445"></span><span>    </span><span class="annot"><a href="#local-6989586621679159100"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1446"></span><span>    </span><span class="annot"><a href="#local-6989586621679159100"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159091"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159091"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159090"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159090"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159089"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159089"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159088"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159088"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1447"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159091"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159087"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1448"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159090"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159100"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159091"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159089"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159088"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1449"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; Set a
</span><a href="#local-6989586621679159100"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159091"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159087"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159088"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1450"></span><span>        </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159090"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159088"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1451"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679159087"><span class="annot"><span class="annottext">sizeL :: Int
</span><a href="#local-6989586621679159087"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159089"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1452"></span><span>
</span><span id="line-1453"></span><span class="hs-comment">-- | /O(log n)/. Split a set at a particular index.</span><span>
</span><span id="line-1454"></span><span class="hs-comment">--</span><span>
</span><span id="line-1455"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1456"></span><span class="hs-comment">-- splitAt !n !xs = ('take' n xs, 'drop' n xs)</span><span>
</span><span id="line-1457"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1458"></span><span id="local-6989586621679160367"><span class="annot"><a href="Data.Set.Internal.html#splitAt"><span class="hs-identifier hs-type">splitAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160367"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160367"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160367"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1459"></span><span id="splitAt"><span class="annot"><span class="annottext">splitAt :: forall a. Int -&gt; Set a -&gt; (Set a, Set a)
</span><a href="Data.Set.Internal.html#splitAt"><span class="hs-identifier hs-var hs-var">splitAt</span></a></span></span><span> </span><span id="local-6989586621679159084"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159084"><span class="hs-identifier hs-var">i0</span></a></span></span><span> </span><span id="local-6989586621679159083"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159083"><span class="hs-identifier hs-var">m0</span></a></span></span><span>
</span><span id="line-1460"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159084"><span class="hs-identifier hs-var">i0</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159083"><span class="hs-identifier hs-var">m0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159083"><span class="hs-identifier hs-var">m0</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1461"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Set a) (Set a) -&gt; (Set a, Set a))
-&gt; StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall {a}. Int -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159082"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159084"><span class="hs-identifier hs-var">i0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159083"><span class="hs-identifier hs-var">m0</span></a></span><span>
</span><span id="line-1462"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1463"></span><span>    </span><span id="local-6989586621679159082"><span class="annot"><span class="annottext">go :: Int -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159082"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679159075"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159075"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679159074"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159074"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159075"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159074"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1464"></span><span>    </span><span class="annot"><a href="#local-6989586621679159082"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1465"></span><span>    </span><span class="annot"><a href="#local-6989586621679159082"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159073"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159073"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159072"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159072"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159071"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159071"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159070"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159070"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1466"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159073"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159069"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1467"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159082"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159073"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159071"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1468"></span><span>                  </span><span id="local-6989586621679159068"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159068"><span class="hs-identifier hs-var">ll</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159067"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159067"><span class="hs-identifier hs-var">lr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159068"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159072"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159067"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159070"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1469"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159082"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159073"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159069"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159070"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1470"></span><span>                  </span><span id="local-6989586621679159066"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159066"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159065"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159065"><span class="hs-identifier hs-var">rr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159072"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159071"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159066"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159065"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-1471"></span><span>          </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159071"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159072"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159070"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1472"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679159069"><span class="annot"><span class="annottext">sizeL :: Int
</span><a href="#local-6989586621679159069"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159071"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1473"></span><span>
</span><span id="line-1474"></span><span class="hs-comment">-- | /O(log n)/. Take while a predicate on the elements holds.</span><span>
</span><span id="line-1475"></span><span class="hs-comment">-- The user is responsible for ensuring that for all elements @j@ and @k@ in the set,</span><span>
</span><span id="line-1476"></span><span class="hs-comment">-- @j \&lt; k ==\&gt; p j \&gt;= p k@. See note at 'spanAntitone'.</span><span>
</span><span id="line-1477"></span><span class="hs-comment">--</span><span>
</span><span id="line-1478"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1479"></span><span class="hs-comment">-- takeWhileAntitone p = 'fromDistinctAscList' . 'Data.List.takeWhile' p . 'toList'</span><span>
</span><span id="line-1480"></span><span class="hs-comment">-- takeWhileAntitone p = 'filter' p</span><span>
</span><span id="line-1481"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1482"></span><span class="hs-comment">--</span><span>
</span><span id="line-1483"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1484"></span><span>
</span><span id="line-1485"></span><span id="local-6989586621679159064"><span class="annot"><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier hs-type">takeWhileAntitone</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159064"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159064"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159064"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1486"></span><span id="takeWhileAntitone"><span class="annot"><span class="annottext">takeWhileAntitone :: forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier hs-var hs-var">takeWhileAntitone</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1487"></span><span class="annot"><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier hs-var">takeWhileAntitone</span></a></span><span> </span><span id="local-6989586621679159063"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159063"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159062"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159062"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159061"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159061"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159060"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159060"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1488"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159063"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159062"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159062"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159061"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier hs-var">takeWhileAntitone</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159063"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159060"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1489"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#takeWhileAntitone"><span class="hs-identifier hs-var">takeWhileAntitone</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159063"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159061"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1490"></span><span>
</span><span id="line-1491"></span><span class="hs-comment">-- | /O(log n)/. Drop while a predicate on the elements holds.</span><span>
</span><span id="line-1492"></span><span class="hs-comment">-- The user is responsible for ensuring that for all elements @j@ and @k@ in the set,</span><span>
</span><span id="line-1493"></span><span class="hs-comment">-- @j \&lt; k ==\&gt; p j \&gt;= p k@. See note at 'spanAntitone'.</span><span>
</span><span id="line-1494"></span><span class="hs-comment">--</span><span>
</span><span id="line-1495"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1496"></span><span class="hs-comment">-- dropWhileAntitone p = 'fromDistinctAscList' . 'Data.List.dropWhile' p . 'toList'</span><span>
</span><span id="line-1497"></span><span class="hs-comment">-- dropWhileAntitone p = 'filter' (not . p)</span><span>
</span><span id="line-1498"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1499"></span><span class="hs-comment">--</span><span>
</span><span id="line-1500"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1501"></span><span>
</span><span id="line-1502"></span><span id="local-6989586621679159059"><span class="annot"><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier hs-type">dropWhileAntitone</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159059"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159059"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159059"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1503"></span><span id="dropWhileAntitone"><span class="annot"><span class="annottext">dropWhileAntitone :: forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier hs-var hs-var">dropWhileAntitone</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1504"></span><span class="annot"><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier hs-var">dropWhileAntitone</span></a></span><span> </span><span id="local-6989586621679159058"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159058"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159057"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159057"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159056"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159056"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159055"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159055"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1505"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159058"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159057"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier hs-var">dropWhileAntitone</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159058"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159055"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1506"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159057"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; Set a
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#dropWhileAntitone"><span class="hs-identifier hs-var">dropWhileAntitone</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159058"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159056"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159055"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1507"></span><span>
</span><span id="line-1508"></span><span class="hs-comment">-- | /O(log n)/. Divide a set at the point where a predicate on the elements stops holding.</span><span>
</span><span id="line-1509"></span><span class="hs-comment">-- The user is responsible for ensuring that for all elements @j@ and @k@ in the set,</span><span>
</span><span id="line-1510"></span><span class="hs-comment">-- @j \&lt; k ==\&gt; p j \&gt;= p k@.</span><span>
</span><span id="line-1511"></span><span class="hs-comment">--</span><span>
</span><span id="line-1512"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1513"></span><span class="hs-comment">-- spanAntitone p xs = ('takeWhileAntitone' p xs, 'dropWhileAntitone' p xs)</span><span>
</span><span id="line-1514"></span><span class="hs-comment">-- spanAntitone p xs = partition p xs</span><span>
</span><span id="line-1515"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1516"></span><span class="hs-comment">--</span><span>
</span><span id="line-1517"></span><span class="hs-comment">-- Note: if @p@ is not actually antitone, then @spanAntitone@ will split the set</span><span>
</span><span id="line-1518"></span><span class="hs-comment">-- at some /unspecified/ point where the predicate switches from holding to not</span><span>
</span><span id="line-1519"></span><span class="hs-comment">-- holding (where the predicate is seen to hold before the first element and to fail</span><span>
</span><span id="line-1520"></span><span class="hs-comment">-- after the last element).</span><span>
</span><span id="line-1521"></span><span class="hs-comment">--</span><span>
</span><span id="line-1522"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1523"></span><span>
</span><span id="line-1524"></span><span id="local-6989586621679159054"><span class="annot"><a href="Data.Set.Internal.html#spanAntitone"><span class="hs-identifier hs-type">spanAntitone</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679159054"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159054"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159054"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159054"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1525"></span><span id="spanAntitone"><span class="annot"><span class="annottext">spanAntitone :: forall a. (a -&gt; Bool) -&gt; Set a -&gt; (Set a, Set a)
</span><a href="Data.Set.Internal.html#spanAntitone"><span class="hs-identifier hs-var hs-var">spanAntitone</span></a></span></span><span> </span><span id="local-6989586621679159053"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159053"><span class="hs-identifier hs-var">p0</span></a></span></span><span> </span><span id="local-6989586621679159052"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159052"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Set a) (Set a) -&gt; (Set a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall {a}. (a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159051"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159053"><span class="hs-identifier hs-var">p0</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159052"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1526"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1527"></span><span>    </span><span id="local-6989586621679159051"><span class="annot"><span class="annottext">go :: (a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159051"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1528"></span><span>    </span><span class="annot"><a href="#local-6989586621679159051"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679159050"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159050"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159049"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159049"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159048"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159048"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159047"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159047"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1529"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159050"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159049"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679159046"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159046"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159045"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159045"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159051"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159050"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159047"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159049"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159048"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159046"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159045"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-1530"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679159044"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159044"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679159043"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159043"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Set a -&gt; StrictPair (Set a) (Set a)
</span><a href="#local-6989586621679159051"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679159050"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159048"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159044"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; StrictPair (Set a) (Set a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159049"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159043"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159047"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1531"></span><span>
</span><span id="line-1532"></span><span>
</span><span id="line-1533"></span><span class="hs-comment">{--------------------------------------------------------------------
  Utility functions that maintain the balance properties of the tree.
  All constructors assume that all values in [l] &lt; [x] and all values
  in [r] &gt; [x], and that [l] and [r] are valid trees.

  In order of sophistication:
    [Bin sz x l r]    The type constructor.
    [bin x l r]       Maintains the correct size, assumes that both [l]
                      and [r] are balanced with respect to each other.
    [balance x l r]   Restores the balance and size.
                      Assumes that the original tree was balanced and
                      that [l] or [r] has changed by at most one element.
    [link x l r]      Restores balance and size.

  Furthermore, we can construct a new tree from two trees. Both operations
  assume that all values in [l] &lt; all values in [r] and that [l] and [r]
  are valid:
    [glue l r]        Glues [l] and [r] together. Assumes that [l] and
                      [r] are already balanced with respect to each other.
    [merge l r]       Merges two trees and restores balance.
--------------------------------------------------------------------}</span><span>
</span><span id="line-1554"></span><span>
</span><span id="line-1555"></span><span class="hs-comment">{--------------------------------------------------------------------
  Link
--------------------------------------------------------------------}</span><span>
</span><span id="line-1558"></span><span id="local-6989586621679159042"><span class="annot"><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-type">link</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679159042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159042"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1559"></span><span id="link"><span class="annot"><span class="annottext">link :: forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var hs-var">link</span></a></span></span><span> </span><span id="local-6989586621679159037"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159037"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679159036"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159036"><span class="hs-identifier hs-var">r</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159037"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159036"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1560"></span><span class="annot"><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span id="local-6989586621679159035"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159035"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159034"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159034"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159035"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159034"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1561"></span><span class="annot"><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span id="local-6989586621679159033"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159033"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159032"><span class="annot"><span class="annottext">l :: Set a
</span><a href="#local-6989586621679159032"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159031"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159031"><span class="hs-identifier hs-var">sizeL</span></a></span></span><span> </span><span id="local-6989586621679159030"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159030"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159029"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159029"><span class="hs-identifier hs-var">ly</span></a></span></span><span> </span><span id="local-6989586621679159028"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159028"><span class="hs-identifier hs-var">ry</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679159027"><span class="annot"><span class="annottext">r :: Set a
</span><a href="#local-6989586621679159027"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159026"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159026"><span class="hs-identifier hs-var">sizeR</span></a></span></span><span> </span><span id="local-6989586621679159025"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159025"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679159024"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159024"><span class="hs-identifier hs-var">lz</span></a></span></span><span> </span><span id="local-6989586621679159023"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159023"><span class="hs-identifier hs-var">rz</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1562"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159031"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159026"><span class="hs-identifier hs-var">sizeR</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159025"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159033"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159032"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159024"><span class="hs-identifier hs-var">lz</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159023"><span class="hs-identifier hs-var">rz</span></a></span><span>
</span><span id="line-1563"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159026"><span class="hs-identifier hs-var">sizeR</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159031"><span class="hs-identifier hs-var">sizeL</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159030"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159029"><span class="hs-identifier hs-var">ly</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159033"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159028"><span class="hs-identifier hs-var">ry</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159027"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1564"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159033"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159032"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159027"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1565"></span><span>
</span><span id="line-1566"></span><span>
</span><span id="line-1567"></span><span class="hs-comment">-- insertMin and insertMax don't perform potentially expensive comparisons.</span><span>
</span><span id="line-1568"></span><span id="local-6989586621679160448"><span class="annot"><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-type">insertMax</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-type">insertMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679160448"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160448"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160448"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1569"></span><span id="insertMax"><span class="annot"><span class="annottext">insertMax :: forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-var hs-var">insertMax</span></a></span></span><span> </span><span id="local-6989586621679159021"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159021"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159020"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159020"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1570"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159020"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1571"></span><span>      </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159021"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1572"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159019"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159019"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159018"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159018"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159017"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159017"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1573"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159019"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159018"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159021"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159017"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1574"></span><span>
</span><span id="line-1575"></span><span id="insertMin"><span class="annot"><span class="annottext">insertMin :: forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var hs-var">insertMin</span></a></span></span><span> </span><span id="local-6989586621679159016"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159016"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159015"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159015"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1576"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159015"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1577"></span><span>      </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159016"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1578"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679159014"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159014"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679159013"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159013"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679159012"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159012"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1579"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159014"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159016"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159013"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159012"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1580"></span><span>
</span><span id="line-1581"></span><span class="hs-comment">{--------------------------------------------------------------------
  [merge l r]: merges two trees.
--------------------------------------------------------------------}</span><span>
</span><span id="line-1584"></span><span id="local-6989586621679159011"><span class="annot"><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-type">merge</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159011"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159011"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679159011"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1585"></span><span id="merge"><span class="annot"><span class="annottext">merge :: forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var hs-var">merge</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679159006"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159006"><span class="hs-identifier hs-var">r</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159006"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1586"></span><span class="annot"><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span id="local-6989586621679159005"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159005"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159005"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1587"></span><span class="annot"><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span id="local-6989586621679159004"><span class="annot"><span class="annottext">l :: Set a
</span><a href="#local-6989586621679159004"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679159003"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159003"><span class="hs-identifier hs-var">sizeL</span></a></span></span><span> </span><span id="local-6989586621679159002"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159002"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679159001"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159001"><span class="hs-identifier hs-var">lx</span></a></span></span><span> </span><span id="local-6989586621679159000"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159000"><span class="hs-identifier hs-var">rx</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679158999"><span class="annot"><span class="annottext">r :: Set a
</span><a href="#local-6989586621679158999"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158998"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158998"><span class="hs-identifier hs-var">sizeR</span></a></span></span><span> </span><span id="local-6989586621679158997"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158997"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679158996"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158996"><span class="hs-identifier hs-var">ly</span></a></span></span><span> </span><span id="local-6989586621679158995"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158995"><span class="hs-identifier hs-var">ry</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1588"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159003"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158998"><span class="hs-identifier hs-var">sizeR</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158997"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159004"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158996"><span class="hs-identifier hs-var">ly</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158995"><span class="hs-identifier hs-var">ry</span></a></span><span>
</span><span id="line-1589"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158998"><span class="hs-identifier hs-var">sizeR</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679159003"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679159002"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159001"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159000"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158999"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1590"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679159004"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158999"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1591"></span><span>
</span><span id="line-1592"></span><span class="hs-comment">{--------------------------------------------------------------------
  [glue l r]: glues two trees together.
  Assumes that [l] and [r] are already balanced with respect to each other.
--------------------------------------------------------------------}</span><span>
</span><span id="line-1596"></span><span id="local-6989586621679160540"><span class="annot"><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-type">glue</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160540"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160540"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160540"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1597"></span><span id="glue"><span class="annot"><span class="annottext">glue :: forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var hs-var">glue</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679158993"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158993"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158993"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1598"></span><span class="annot"><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span id="local-6989586621679158992"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158992"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158992"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1599"></span><span class="annot"><a href="Data.Set.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span id="local-6989586621679158991"><span class="annot"><span class="annottext">l :: Set a
</span><a href="#local-6989586621679158991"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158990"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158990"><span class="hs-identifier hs-var">sl</span></a></span></span><span> </span><span id="local-6989586621679158989"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158989"><span class="hs-identifier hs-var">xl</span></a></span></span><span> </span><span id="local-6989586621679158988"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158988"><span class="hs-identifier hs-var">ll</span></a></span></span><span> </span><span id="local-6989586621679158987"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158987"><span class="hs-identifier hs-var">lr</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679158986"><span class="annot"><span class="annottext">r :: Set a
</span><a href="#local-6989586621679158986"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158985"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158985"><span class="hs-identifier hs-var">sr</span></a></span></span><span> </span><span id="local-6989586621679158984"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158984"><span class="hs-identifier hs-var">xr</span></a></span></span><span> </span><span id="local-6989586621679158983"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158983"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621679158982"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158982"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1600"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158990"><span class="hs-identifier hs-var">sl</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158985"><span class="hs-identifier hs-var">sr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679158981"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158981"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679158980"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158980"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#maxViewSure"><span class="hs-identifier hs-var">maxViewSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158989"><span class="hs-identifier hs-var">xl</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158988"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158987"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158981"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158980"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158986"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1601"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679158978"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158978"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679158977"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158977"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#minViewSure"><span class="hs-identifier hs-var">minViewSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158984"><span class="hs-identifier hs-var">xr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158983"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158982"><span class="hs-identifier hs-var">rr</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158978"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158991"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158977"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1602"></span><span>
</span><span id="line-1603"></span><span class="hs-comment">-- | /O(log n)/. Delete and find the minimal element.</span><span>
</span><span id="line-1604"></span><span class="hs-comment">--</span><span>
</span><span id="line-1605"></span><span class="hs-comment">-- &gt; deleteFindMin set = (findMin set, deleteMin set)</span><span>
</span><span id="line-1606"></span><span>
</span><span id="line-1607"></span><span id="local-6989586621679160354"><span class="annot"><a href="Data.Set.Internal.html#deleteFindMin"><span class="hs-identifier hs-type">deleteFindMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160354"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160354"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160354"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1608"></span><span id="deleteFindMin"><span class="annot"><span class="annottext">deleteFindMin :: forall a. Set a -&gt; (a, Set a)
</span><a href="Data.Set.Internal.html#deleteFindMin"><span class="hs-identifier hs-var hs-var">deleteFindMin</span></a></span></span><span> </span><span id="local-6989586621679158973"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158973"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1609"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679158972"><span class="annot"><span class="annottext">(a, Set a)
</span><a href="#local-6989586621679158972"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Maybe (a, Set a)
forall a. Set a -&gt; Maybe (a, Set a)
</span><a href="Data.Set.Internal.html#minView"><span class="hs-identifier hs-var">minView</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158973"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Set a)
</span><a href="#local-6989586621679158972"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1610"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.deleteFindMin: can not return the minimal element of an empty set&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1611"></span><span>
</span><span id="line-1612"></span><span class="hs-comment">-- | /O(log n)/. Delete and find the maximal element.</span><span>
</span><span id="line-1613"></span><span class="hs-comment">--</span><span>
</span><span id="line-1614"></span><span class="hs-comment">-- &gt; deleteFindMax set = (findMax set, deleteMax set)</span><span>
</span><span id="line-1615"></span><span id="local-6989586621679158971"><span class="annot"><a href="Data.Set.Internal.html#deleteFindMax"><span class="hs-identifier hs-type">deleteFindMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158971"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679158971"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158971"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1616"></span><span id="deleteFindMax"><span class="annot"><span class="annottext">deleteFindMax :: forall a. Set a -&gt; (a, Set a)
</span><a href="Data.Set.Internal.html#deleteFindMax"><span class="hs-identifier hs-var hs-var">deleteFindMax</span></a></span></span><span> </span><span id="local-6989586621679158968"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158968"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1617"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679158967"><span class="annot"><span class="annottext">(a, Set a)
</span><a href="#local-6989586621679158967"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Maybe (a, Set a)
forall a. Set a -&gt; Maybe (a, Set a)
</span><a href="Data.Set.Internal.html#maxView"><span class="hs-identifier hs-var">maxView</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158968"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Set a)
</span><a href="#local-6989586621679158967"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1618"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Set.deleteFindMax: can not return the maximal element of an empty set&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1619"></span><span>
</span><span id="line-1620"></span><span id="local-6989586621679158966"><span class="annot"><a href="Data.Set.Internal.html#minViewSure"><span class="hs-identifier hs-type">minViewSure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679158966"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158966"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158966"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158966"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158966"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1621"></span><span id="minViewSure"><span class="annot"><span class="annottext">minViewSure :: forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#minViewSure"><span class="hs-identifier hs-var hs-var">minViewSure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="#local-6989586621679158965"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1622"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1623"></span><span>    </span><span id="local-6989586621679158965"><span class="annot"><span class="annottext">go :: t -&gt; Set t -&gt; Set t -&gt; StrictPair t (Set t)
</span><a href="#local-6989586621679158965"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679158964"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158964"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679158963"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158963"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158964"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; StrictPair t (Set t)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158963"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1624"></span><span>    </span><span class="annot"><a href="#local-6989586621679158965"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679158962"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158962"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158961"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158961"><span class="hs-identifier hs-var">xl</span></a></span></span><span> </span><span id="local-6989586621679158960"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158960"><span class="hs-identifier hs-var">ll</span></a></span></span><span> </span><span id="local-6989586621679158959"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158959"><span class="hs-identifier hs-var">lr</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679158958"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158958"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1625"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Set t -&gt; StrictPair t (Set t)
</span><a href="#local-6989586621679158965"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158961"><span class="hs-identifier hs-var">xl</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158960"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158959"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1626"></span><span>        </span><span id="local-6989586621679158957"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158957"><span class="hs-identifier hs-var">xm</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679158956"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158956"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158957"><span class="hs-identifier hs-var">xm</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; StrictPair t (Set t)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Set t -&gt; Set t
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158962"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158956"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158958"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1627"></span><span>
</span><span id="line-1628"></span><span class="hs-comment">-- | /O(log n)/. Retrieves the minimal key of the set, and the set</span><span>
</span><span id="line-1629"></span><span class="hs-comment">-- stripped of that element, or 'Nothing' if passed an empty set.</span><span>
</span><span id="line-1630"></span><span id="local-6989586621679160352"><span class="annot"><a href="Data.Set.Internal.html#minView"><span class="hs-identifier hs-type">minView</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160352"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160352"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160352"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1631"></span><span id="minView"><span class="annot"><span class="annottext">minView :: forall a. Set a -&gt; Maybe (a, Set a)
</span><a href="Data.Set.Internal.html#minView"><span class="hs-identifier hs-var hs-var">minView</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (a, Set a)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1632"></span><span class="annot"><a href="Data.Set.Internal.html#minView"><span class="hs-identifier hs-var">minView</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158955"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158955"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158954"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158954"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158953"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158953"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Set a) -&gt; Maybe (a, Set a)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((a, Set a) -&gt; Maybe (a, Set a)) -&gt; (a, Set a) -&gt; Maybe (a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">StrictPair a (Set a) -&gt; (a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair a (Set a) -&gt; (a, Set a))
-&gt; StrictPair a (Set a) -&gt; (a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#minViewSure"><span class="hs-identifier hs-var">minViewSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158955"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158954"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158953"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1633"></span><span>
</span><span id="line-1634"></span><span id="local-6989586621679160355"><span class="annot"><a href="Data.Set.Internal.html#maxViewSure"><span class="hs-identifier hs-type">maxViewSure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679160355"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160355"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160355"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160355"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160355"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1635"></span><span id="maxViewSure"><span class="annot"><span class="annottext">maxViewSure :: forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#maxViewSure"><span class="hs-identifier hs-var hs-var">maxViewSure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="#local-6989586621679158952"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1636"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1637"></span><span>    </span><span id="local-6989586621679158952"><span class="annot"><span class="annottext">go :: t -&gt; Set t -&gt; Set t -&gt; StrictPair t (Set t)
</span><a href="#local-6989586621679158952"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679158951"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158951"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158950"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158950"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158951"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; StrictPair t (Set t)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158950"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1638"></span><span>    </span><span class="annot"><a href="#local-6989586621679158952"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679158949"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158949"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158948"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158948"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158947"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158947"><span class="hs-identifier hs-var">xr</span></a></span></span><span> </span><span id="local-6989586621679158946"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158946"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621679158945"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158945"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1639"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Set t -&gt; StrictPair t (Set t)
</span><a href="#local-6989586621679158952"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158947"><span class="hs-identifier hs-var">xr</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158946"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158945"><span class="hs-identifier hs-var">rr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1640"></span><span>        </span><span id="local-6989586621679158944"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158944"><span class="hs-identifier hs-var">xm</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679158943"><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158943"><span class="hs-identifier hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158944"><span class="hs-identifier hs-var">xm</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; StrictPair t (Set t)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Set t -&gt; Set t -&gt; Set t
forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679158949"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158948"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set t
</span><a href="#local-6989586621679158943"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1641"></span><span>
</span><span id="line-1642"></span><span class="hs-comment">-- | /O(log n)/. Retrieves the maximal key of the set, and the set</span><span>
</span><span id="line-1643"></span><span class="hs-comment">-- stripped of that element, or 'Nothing' if passed an empty set.</span><span>
</span><span id="line-1644"></span><span id="local-6989586621679158942"><span class="annot"><a href="Data.Set.Internal.html#maxView"><span class="hs-identifier hs-type">maxView</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158942"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679158942"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158942"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1645"></span><span id="maxView"><span class="annot"><span class="annottext">maxView :: forall a. Set a -&gt; Maybe (a, Set a)
</span><a href="Data.Set.Internal.html#maxView"><span class="hs-identifier hs-var hs-var">maxView</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (a, Set a)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1646"></span><span class="annot"><a href="Data.Set.Internal.html#maxView"><span class="hs-identifier hs-var">maxView</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158941"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158941"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158940"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158940"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158939"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158939"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Set a) -&gt; Maybe (a, Set a)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((a, Set a) -&gt; Maybe (a, Set a)) -&gt; (a, Set a) -&gt; Maybe (a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">StrictPair a (Set a) -&gt; (a, Set a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair a (Set a) -&gt; (a, Set a))
-&gt; StrictPair a (Set a) -&gt; (a, Set a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
forall a. a -&gt; Set a -&gt; Set a -&gt; StrictPair a (Set a)
</span><a href="Data.Set.Internal.html#maxViewSure"><span class="hs-identifier hs-var">maxViewSure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158941"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158940"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158939"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1647"></span><span>
</span><span id="line-1648"></span><span class="hs-comment">{--------------------------------------------------------------------
  [balance x l r] balances two trees with value x.
  The sizes of the trees should balance after decreasing the
  size of one of them. (a rotation).

  [delta] is the maximal relative difference between the sizes of
          two trees, it corresponds with the [w] in Adams' paper.
  [ratio] is the ratio between an outer and inner sibling of the
          heavier subtree in an unbalanced setting. It determines
          whether a double or single rotation should be performed
          to restore balance. It is correspondes with the inverse
          of $\alpha$ in Adam's article.

  Note that according to the Adam's paper:
  - [delta] should be larger than 4.646 with a [ratio] of 2.
  - [delta] should be larger than 3.745 with a [ratio] of 1.534.

  But the Adam's paper is errorneous:
  - it can be proved that for delta=2 and delta&gt;=5 there does
    not exist any ratio that would work
  - delta=4.5 and ratio=2 does not work

  That leaves two reasonable variants, delta=3 and delta=4,
  both with ratio=2.

  - A lower [delta] leads to a more 'perfectly' balanced tree.
  - A higher [delta] performs less rebalancing.

  In the benchmarks, delta=3 is faster on insert operations,
  and delta=4 has slightly better deletes. As the insert speedup
  is larger, we currently use delta=3.

--------------------------------------------------------------------}</span><span>
</span><span id="line-1681"></span><span class="annot"><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-type">delta</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-type">ratio</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-1682"></span><span id="delta"><span class="annot"><span class="annottext">delta :: Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var hs-var">delta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span>
</span><span id="line-1683"></span><span id="ratio"><span class="annot"><span class="annottext">ratio :: Int
</span><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-var hs-var">ratio</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-1684"></span><span>
</span><span id="line-1685"></span><span class="hs-comment">-- The balance function is equivalent to the following:</span><span>
</span><span id="line-1686"></span><span class="hs-comment">--</span><span>
</span><span id="line-1687"></span><span class="hs-comment">--   balance :: a -&gt; Set a -&gt; Set a -&gt; Set a</span><span>
</span><span id="line-1688"></span><span class="hs-comment">--   balance x l r</span><span>
</span><span id="line-1689"></span><span class="hs-comment">--     | sizeL + sizeR &lt;= 1   = Bin sizeX x l r</span><span>
</span><span id="line-1690"></span><span class="hs-comment">--     | sizeR &gt; delta*sizeL  = rotateL x l r</span><span>
</span><span id="line-1691"></span><span class="hs-comment">--     | sizeL &gt; delta*sizeR  = rotateR x l r</span><span>
</span><span id="line-1692"></span><span class="hs-comment">--     | otherwise            = Bin sizeX x l r</span><span>
</span><span id="line-1693"></span><span class="hs-comment">--     where</span><span>
</span><span id="line-1694"></span><span class="hs-comment">--       sizeL = size l</span><span>
</span><span id="line-1695"></span><span class="hs-comment">--       sizeR = size r</span><span>
</span><span id="line-1696"></span><span class="hs-comment">--       sizeX = sizeL + sizeR + 1</span><span>
</span><span id="line-1697"></span><span class="hs-comment">--</span><span>
</span><span id="line-1698"></span><span class="hs-comment">--   rotateL :: a -&gt; Set a -&gt; Set a -&gt; Set a</span><span>
</span><span id="line-1699"></span><span class="hs-comment">--   rotateL x l r@(Bin _ _ ly ry) | size ly &lt; ratio*size ry = singleL x l r</span><span>
</span><span id="line-1700"></span><span class="hs-comment">--                                 | otherwise               = doubleL x l r</span><span>
</span><span id="line-1701"></span><span class="hs-comment">--   rotateR :: a -&gt; Set a -&gt; Set a -&gt; Set a</span><span>
</span><span id="line-1702"></span><span class="hs-comment">--   rotateR x l@(Bin _ _ ly ry) r | size ry &lt; ratio*size ly = singleR x l r</span><span>
</span><span id="line-1703"></span><span class="hs-comment">--                                 | otherwise               = doubleR x l r</span><span>
</span><span id="line-1704"></span><span class="hs-comment">--</span><span>
</span><span id="line-1705"></span><span class="hs-comment">--   singleL, singleR :: a -&gt; Set a -&gt; Set a -&gt; Set a</span><span>
</span><span id="line-1706"></span><span class="hs-comment">--   singleL x1 t1 (Bin _ x2 t2 t3)  = bin x2 (bin x1 t1 t2) t3</span><span>
</span><span id="line-1707"></span><span class="hs-comment">--   singleR x1 (Bin _ x2 t1 t2) t3  = bin x2 t1 (bin x1 t2 t3)</span><span>
</span><span id="line-1708"></span><span class="hs-comment">--</span><span>
</span><span id="line-1709"></span><span class="hs-comment">--   doubleL, doubleR :: a -&gt; Set a -&gt; Set a -&gt; Set a</span><span>
</span><span id="line-1710"></span><span class="hs-comment">--   doubleL x1 t1 (Bin _ x2 (Bin _ x3 t2 t3) t4) = bin x3 (bin x1 t1 t2) (bin x2 t3 t4)</span><span>
</span><span id="line-1711"></span><span class="hs-comment">--   doubleR x1 (Bin _ x2 t1 (Bin _ x3 t2 t3)) t4 = bin x3 (bin x2 t1 t2) (bin x1 t3 t4)</span><span>
</span><span id="line-1712"></span><span class="hs-comment">--</span><span>
</span><span id="line-1713"></span><span class="hs-comment">-- It is only written in such a way that every node is pattern-matched only once.</span><span>
</span><span id="line-1714"></span><span class="hs-comment">--</span><span>
</span><span id="line-1715"></span><span class="hs-comment">-- Only balanceL and balanceR are needed at the moment, so balance is not here anymore.</span><span>
</span><span id="line-1716"></span><span class="hs-comment">-- In case it is needed, it can be found in Data.Map.</span><span>
</span><span id="line-1717"></span><span>
</span><span id="line-1718"></span><span class="hs-comment">-- Functions balanceL and balanceR are specialised versions of balance.</span><span>
</span><span id="line-1719"></span><span class="hs-comment">-- balanceL only checks whether the left subtree is too big,</span><span>
</span><span id="line-1720"></span><span class="hs-comment">-- balanceR only checks whether the right subtree is too big.</span><span>
</span><span id="line-1721"></span><span>
</span><span id="line-1722"></span><span class="hs-comment">-- balanceL is called when left subtree might have been inserted to or when</span><span>
</span><span id="line-1723"></span><span class="hs-comment">-- right subtree might have been deleted from.</span><span>
</span><span id="line-1724"></span><span id="local-6989586621679160547"><span class="annot"><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-type">balanceL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679160547"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160547"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160547"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160547"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1725"></span><span id="balanceL"><span class="annot"><span class="annottext">balanceL :: forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceL"><span class="hs-identifier hs-var hs-var">balanceL</span></a></span></span><span> </span><span id="local-6989586621679158898"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158897"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158897"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158896"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1726"></span><span>  </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158897"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1727"></span><span>           </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1728"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158897"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1729"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158895"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158895"><span class="hs-identifier hs-var">lx</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158894"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158894"><span class="hs-identifier hs-var">lrx</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158894"><span class="hs-identifier hs-var">lrx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158895"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1730"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158893"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158893"><span class="hs-identifier hs-var">lx</span></a></span></span><span> </span><span id="local-6989586621679158892"><span class="annot"><span class="annottext">ll :: Set a
</span><a href="#local-6989586621679158892"><span class="hs-identifier hs-var">ll</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158893"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158892"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1731"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158891"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158891"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span id="local-6989586621679158890"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158890"><span class="hs-identifier hs-var">lx</span></a></span></span><span> </span><span id="local-6989586621679158889"><span class="annot"><span class="annottext">ll :: Set a
</span><a href="#local-6989586621679158889"><span class="hs-identifier hs-var">ll</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158888"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158888"><span class="hs-identifier hs-var">lls</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679158887"><span class="annot"><span class="annottext">lr :: Set a
</span><a href="#local-6989586621679158887"><span class="hs-identifier hs-var">lr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158886"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158886"><span class="hs-identifier hs-var">lrs</span></a></span></span><span> </span><span id="local-6989586621679158885"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158885"><span class="hs-identifier hs-var">lrx</span></a></span></span><span> </span><span id="local-6989586621679158884"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158884"><span class="hs-identifier hs-var">lrl</span></a></span></span><span> </span><span id="local-6989586621679158883"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158883"><span class="hs-identifier hs-var">lrr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1732"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158886"><span class="hs-identifier hs-var">lrs</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-var">ratio</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158888"><span class="hs-identifier hs-var">lls</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158891"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158890"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158889"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158886"><span class="hs-identifier hs-var">lrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158887"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1733"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158891"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158885"><span class="hs-identifier hs-var">lrx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158888"><span class="hs-identifier hs-var">lls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158884"><span class="hs-identifier hs-var">lrl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158890"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158889"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158884"><span class="hs-identifier hs-var">lrl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158883"><span class="hs-identifier hs-var">lrr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158883"><span class="hs-identifier hs-var">lrr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1734"></span><span>
</span><span id="line-1735"></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158882"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158897"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1736"></span><span>           </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1737"></span><span>
</span><span id="line-1738"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158881"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158881"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span id="local-6989586621679158880"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158880"><span class="hs-identifier hs-var">lx</span></a></span></span><span> </span><span id="local-6989586621679158879"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158879"><span class="hs-identifier hs-var">ll</span></a></span></span><span> </span><span id="local-6989586621679158878"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158878"><span class="hs-identifier hs-var">lr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1739"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158881"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158879"><span class="hs-identifier hs-var">ll</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158878"><span class="hs-identifier hs-var">lr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1740"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158877"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158877"><span class="hs-identifier hs-var">lls</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158876"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158876"><span class="hs-identifier hs-var">lrs</span></a></span></span><span> </span><span id="local-6989586621679158875"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158875"><span class="hs-identifier hs-var">lrx</span></a></span></span><span> </span><span id="local-6989586621679158874"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158874"><span class="hs-identifier hs-var">lrl</span></a></span></span><span> </span><span id="local-6989586621679158873"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158873"><span class="hs-identifier hs-var">lrr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1741"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158876"><span class="hs-identifier hs-var">lrs</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-var">ratio</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158877"><span class="hs-identifier hs-var">lls</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158881"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158880"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158879"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158876"><span class="hs-identifier hs-var">lrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158878"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1742"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158881"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158875"><span class="hs-identifier hs-var">lrx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158877"><span class="hs-identifier hs-var">lls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158874"><span class="hs-identifier hs-var">lrl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158880"><span class="hs-identifier hs-var">lx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158879"><span class="hs-identifier hs-var">ll</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158874"><span class="hs-identifier hs-var">lrl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158873"><span class="hs-identifier hs-var">lrr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158873"><span class="hs-identifier hs-var">lrr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1743"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Set a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Failure in Data.Map.balanceL&quot;</span></span><span>
</span><span id="line-1744"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158881"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158882"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158898"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158897"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158896"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1745"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#balanceL"><span class="hs-pragma hs-type">balanceL</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1746"></span><span>
</span><span id="line-1747"></span><span class="hs-comment">-- balanceR is called when right subtree might have been inserted to or when</span><span>
</span><span id="line-1748"></span><span class="hs-comment">-- left subtree might have been deleted from.</span><span>
</span><span id="line-1749"></span><span id="local-6989586621679158872"><span class="annot"><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-type">balanceR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679158872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158872"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1750"></span><span id="balanceR"><span class="annot"><span class="annottext">balanceR :: forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#balanceR"><span class="hs-identifier hs-var hs-var">balanceR</span></a></span></span><span> </span><span id="local-6989586621679158832"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158831"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158830"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158830"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1751"></span><span>  </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158830"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1752"></span><span>           </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1753"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158830"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1754"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158829"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158829"><span class="hs-identifier hs-var">rx</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679158828"><span class="annot"><span class="annottext">rr :: Set a
</span><a href="#local-6989586621679158828"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158829"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158828"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-1755"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158827"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158827"><span class="hs-identifier hs-var">rx</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158826"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158826"><span class="hs-identifier hs-var">rlx</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158826"><span class="hs-identifier hs-var">rlx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158827"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1756"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158825"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158825"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621679158824"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158824"><span class="hs-identifier hs-var">rx</span></a></span></span><span> </span><span id="local-6989586621679158823"><span class="annot"><span class="annottext">rl :: Set a
</span><a href="#local-6989586621679158823"><span class="hs-identifier hs-var">rl</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158822"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158822"><span class="hs-identifier hs-var">rls</span></a></span></span><span> </span><span id="local-6989586621679158821"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158821"><span class="hs-identifier hs-var">rlx</span></a></span></span><span> </span><span id="local-6989586621679158820"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158820"><span class="hs-identifier hs-var">rll</span></a></span></span><span> </span><span id="local-6989586621679158819"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158819"><span class="hs-identifier hs-var">rlr</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679158818"><span class="annot"><span class="annottext">rr :: Set a
</span><a href="#local-6989586621679158818"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158817"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158817"><span class="hs-identifier hs-var">rrs</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1757"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158822"><span class="hs-identifier hs-var">rls</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-var">ratio</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158817"><span class="hs-identifier hs-var">rrs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158825"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158824"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158822"><span class="hs-identifier hs-var">rls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158823"><span class="hs-identifier hs-var">rl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158818"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-1758"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158825"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158821"><span class="hs-identifier hs-var">rlx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158820"><span class="hs-identifier hs-var">rll</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158820"><span class="hs-identifier hs-var">rll</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158817"><span class="hs-identifier hs-var">rrs</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158819"><span class="hs-identifier hs-var">rlr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158824"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158819"><span class="hs-identifier hs-var">rlr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158818"><span class="hs-identifier hs-var">rr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1759"></span><span>
</span><span id="line-1760"></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158816"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158830"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1761"></span><span>           </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1762"></span><span>
</span><span id="line-1763"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158815"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158815"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621679158814"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158814"><span class="hs-identifier hs-var">rx</span></a></span></span><span> </span><span id="local-6989586621679158813"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158813"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621679158812"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158812"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1764"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158815"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158813"><span class="hs-identifier hs-var">rl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158812"><span class="hs-identifier hs-var">rr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1765"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158811"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158811"><span class="hs-identifier hs-var">rls</span></a></span></span><span> </span><span id="local-6989586621679158810"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158810"><span class="hs-identifier hs-var">rlx</span></a></span></span><span> </span><span id="local-6989586621679158809"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158809"><span class="hs-identifier hs-var">rll</span></a></span></span><span> </span><span id="local-6989586621679158808"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158808"><span class="hs-identifier hs-var">rlr</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158807"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158807"><span class="hs-identifier hs-var">rrs</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-1766"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158811"><span class="hs-identifier hs-var">rls</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#ratio"><span class="hs-identifier hs-var">ratio</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158807"><span class="hs-identifier hs-var">rrs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158815"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158814"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158811"><span class="hs-identifier hs-var">rls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158813"><span class="hs-identifier hs-var">rl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158812"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-1767"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158815"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158810"><span class="hs-identifier hs-var">rlx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158809"><span class="hs-identifier hs-var">rll</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158809"><span class="hs-identifier hs-var">rll</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158807"><span class="hs-identifier hs-var">rrs</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158808"><span class="hs-identifier hs-var">rlr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158814"><span class="hs-identifier hs-var">rx</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158808"><span class="hs-identifier hs-var">rlr</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158812"><span class="hs-identifier hs-var">rr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1768"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Set a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Failure in Data.Map.balanceR&quot;</span></span><span>
</span><span id="line-1769"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158816"><span class="hs-identifier hs-var">ls</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158815"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158832"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158831"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158830"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1770"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#balanceR"><span class="hs-pragma hs-type">balanceR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1771"></span><span>
</span><span id="line-1772"></span><span class="hs-comment">{--------------------------------------------------------------------
  The bin constructor maintains the size of the tree
--------------------------------------------------------------------}</span><span>
</span><span id="line-1775"></span><span id="local-6989586621679158806"><span class="annot"><a href="Data.Set.Internal.html#bin"><span class="hs-identifier hs-type">bin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679158806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158806"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1776"></span><span id="bin"><span class="annot"><span class="annottext">bin :: forall a. a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#bin"><span class="hs-identifier hs-var hs-var">bin</span></a></span></span><span> </span><span id="local-6989586621679158802"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158802"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158801"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158801"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158800"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158800"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1777"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
forall a. Int -&gt; a -&gt; Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158801"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158800"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158802"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158801"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158800"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1778"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#bin"><span class="hs-pragma hs-type">bin</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1779"></span><span>
</span><span id="line-1780"></span><span>
</span><span id="line-1781"></span><span class="hs-comment">{--------------------------------------------------------------------
  Utilities
--------------------------------------------------------------------}</span><span>
</span><span id="line-1784"></span><span>
</span><span id="line-1785"></span><span class="hs-comment">-- | /O(1)/.  Decompose a set into pieces based on the structure of the underlying</span><span>
</span><span id="line-1786"></span><span class="hs-comment">-- tree.  This function is useful for consuming a set in parallel.</span><span>
</span><span id="line-1787"></span><span class="hs-comment">--</span><span>
</span><span id="line-1788"></span><span class="hs-comment">-- No guarantee is made as to the sizes of the pieces; an internal, but</span><span>
</span><span id="line-1789"></span><span class="hs-comment">-- deterministic process determines this.  However, it is guaranteed that the pieces</span><span>
</span><span id="line-1790"></span><span class="hs-comment">-- returned will be in ascending order (all elements in the first subset less than all</span><span>
</span><span id="line-1791"></span><span class="hs-comment">-- elements in the second, and so on).</span><span>
</span><span id="line-1792"></span><span class="hs-comment">--</span><span>
</span><span id="line-1793"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1794"></span><span class="hs-comment">--</span><span>
</span><span id="line-1795"></span><span class="hs-comment">-- &gt; splitRoot (fromList [1..6]) ==</span><span>
</span><span id="line-1796"></span><span class="hs-comment">-- &gt;   [fromList [1,2,3],fromList [4],fromList [5,6]]</span><span>
</span><span id="line-1797"></span><span class="hs-comment">--</span><span>
</span><span id="line-1798"></span><span class="hs-comment">-- &gt; splitRoot empty == []</span><span>
</span><span id="line-1799"></span><span class="hs-comment">--</span><span>
</span><span id="line-1800"></span><span class="hs-comment">--  Note that the current implementation does not return more than three subsets,</span><span>
</span><span id="line-1801"></span><span class="hs-comment">--  but you should not depend on this behaviour because it can change in the</span><span>
</span><span id="line-1802"></span><span class="hs-comment">--  future without notice.</span><span>
</span><span id="line-1803"></span><span class="hs-comment">--</span><span>
</span><span id="line-1804"></span><span class="hs-comment">-- @since 0.5.4</span><span>
</span><span id="line-1805"></span><span id="local-6989586621679160341"><span class="annot"><a href="Data.Set.Internal.html#splitRoot"><span class="hs-identifier hs-type">splitRoot</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160341"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160341"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1806"></span><span id="splitRoot"><span class="annot"><span class="annottext">splitRoot :: forall a. Set a -&gt; [Set a]
</span><a href="Data.Set.Internal.html#splitRoot"><span class="hs-identifier hs-var hs-var">splitRoot</span></a></span></span><span> </span><span id="local-6989586621679158799"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158799"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1807"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158799"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1808"></span><span>    </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1809"></span><span>    </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158798"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158798"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621679158797"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158797"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158796"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158796"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158797"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158798"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158796"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1810"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#splitRoot"><span class="hs-pragma hs-type">splitRoot</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1811"></span><span>
</span><span id="line-1812"></span><span>
</span><span id="line-1813"></span><span class="hs-comment">-- | Calculate the power set of a set: the set of all its subsets.</span><span>
</span><span id="line-1814"></span><span class="hs-comment">--</span><span>
</span><span id="line-1815"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1816"></span><span class="hs-comment">-- t ``member`` powerSet s == t ``isSubsetOf`` s</span><span>
</span><span id="line-1817"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1818"></span><span class="hs-comment">--</span><span>
</span><span id="line-1819"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-1820"></span><span class="hs-comment">--</span><span>
</span><span id="line-1821"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1822"></span><span class="hs-comment">-- powerSet (fromList [1,2,3]) =</span><span>
</span><span id="line-1823"></span><span class="hs-comment">--   fromList $ map fromList [[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]</span><span>
</span><span id="line-1824"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1825"></span><span class="hs-comment">--</span><span>
</span><span id="line-1826"></span><span class="hs-comment">-- @since 0.5.11</span><span>
</span><span id="line-1827"></span><span id="local-6989586621679160339"><span class="annot"><a href="Data.Set.Internal.html#powerSet"><span class="hs-identifier hs-type">powerSet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160339"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160339"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1828"></span><span id="powerSet"><span class="annot"><span class="annottext">powerSet :: forall a. Set a -&gt; Set (Set a)
</span><a href="Data.Set.Internal.html#powerSet"><span class="hs-identifier hs-var hs-var">powerSet</span></a></span></span><span> </span><span id="local-6989586621679158795"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158795"><span class="hs-identifier hs-var">xs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set (Set a) -&gt; Set (Set a)
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Set (Set a) -&gt; Set (Set a))
-&gt; Set (Set a) -&gt; Set a -&gt; Set (Set a)
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Set a -&gt; b
</span><a href="Data.Set.Internal.html#foldr%27"><span class="hs-identifier hs-var">foldr'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Set (Set a) -&gt; Set (Set a)
forall {a}. a -&gt; Set (Set a) -&gt; Set (Set a)
</span><a href="#local-6989586621679158794"><span class="hs-identifier hs-var">step</span></a></span><span> </span><span class="annot"><span class="annottext">Set (Set a)
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158795"><span class="hs-identifier hs-var">xs0</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1829"></span><span>  </span><span id="local-6989586621679158794"><span class="annot"><span class="annottext">step :: a -&gt; Set (Set a) -&gt; Set (Set a)
</span><a href="#local-6989586621679158794"><span class="hs-identifier hs-var hs-var">step</span></a></span></span><span> </span><span id="local-6989586621679158793"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158793"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158792"><span class="annot"><span class="annottext">Set (Set a)
</span><a href="#local-6989586621679158792"><span class="hs-identifier hs-var">pxs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Set (Set a) -&gt; Set (Set a)
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a
forall a. a -&gt; Set a
</span><a href="Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158793"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Set a -&gt; Set a
forall a. a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#insertMin"><span class="hs-identifier hs-var">insertMin</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158793"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">(Set a -&gt; Set a) -&gt; Set (Set a) -&gt; Set (Set a)
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-operator hs-var">`mapMonotonic`</span></a></span><span> </span><span class="annot"><span class="annottext">Set (Set a)
</span><a href="#local-6989586621679158792"><span class="hs-identifier hs-var">pxs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set (Set a) -&gt; Set (Set a) -&gt; Set (Set a)
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#glue"><span class="hs-operator hs-var">`glue`</span></a></span><span> </span><span class="annot"><span class="annottext">Set (Set a)
</span><a href="#local-6989586621679158792"><span class="hs-identifier hs-var">pxs</span></a></span><span>
</span><span id="line-1830"></span><span>
</span><span id="line-1831"></span><span class="hs-comment">-- | /O(m*n)/ (conjectured). Calculate the Cartesian product of two sets.</span><span>
</span><span id="line-1832"></span><span class="hs-comment">--</span><span>
</span><span id="line-1833"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1834"></span><span class="hs-comment">-- cartesianProduct xs ys = fromList $ liftA2 (,) (toList xs) (toList ys)</span><span>
</span><span id="line-1835"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1836"></span><span class="hs-comment">--</span><span>
</span><span id="line-1837"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-1838"></span><span class="hs-comment">--</span><span>
</span><span id="line-1839"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1840"></span><span class="hs-comment">-- cartesianProduct (fromList [1,2]) (fromList [\'a\',\'b\']) =</span><span>
</span><span id="line-1841"></span><span class="hs-comment">--   fromList [(1,\'a\'), (1,\'b\'), (2,\'a\'), (2,\'b\')]</span><span>
</span><span id="line-1842"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1843"></span><span class="hs-comment">--</span><span>
</span><span id="line-1844"></span><span class="hs-comment">-- @since 0.5.11</span><span>
</span><span id="line-1845"></span><span id="local-6989586621679160335"><span id="local-6989586621679160336"><span class="annot"><a href="Data.Set.Internal.html#cartesianProduct"><span class="hs-identifier hs-type">cartesianProduct</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160336"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160335"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679160336"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679160335"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-1846"></span><span class="hs-comment">-- I don't know for sure if this implementation (slightly modified from one</span><span>
</span><span id="line-1847"></span><span class="hs-comment">-- that Edward Kmett hacked together) is optimal. TODO: try to prove or</span><span>
</span><span id="line-1848"></span><span class="hs-comment">-- refute it.</span><span>
</span><span id="line-1849"></span><span class="hs-comment">--</span><span>
</span><span id="line-1850"></span><span class="hs-comment">-- We could definitely get big-O optimal (O(m * n)) in a rather simple way:</span><span>
</span><span id="line-1851"></span><span class="hs-comment">--</span><span>
</span><span id="line-1852"></span><span class="hs-comment">--   cartesianProduct _as Tip = Tip</span><span>
</span><span id="line-1853"></span><span class="hs-comment">--   cartesianProduct as bs = fromDistinctAscList</span><span>
</span><span id="line-1854"></span><span class="hs-comment">--     [(a,b) | a &lt;- toList as, b &lt;- toList bs]</span><span>
</span><span id="line-1855"></span><span class="hs-comment">--</span><span>
</span><span id="line-1856"></span><span class="hs-comment">-- Unfortunately, this is much slower in practice, at least when the sets are</span><span>
</span><span id="line-1857"></span><span class="hs-comment">-- constructed from ascending lists. I tried doing the same thing using a</span><span>
</span><span id="line-1858"></span><span class="hs-comment">-- known-length (perfect balancing) variant of fromDistinctAscList, but it</span><span>
</span><span id="line-1859"></span><span class="hs-comment">-- still didn't come close to the performance of Kmett's version in my very</span><span>
</span><span id="line-1860"></span><span class="hs-comment">-- informal tests.</span><span>
</span><span id="line-1861"></span><span>
</span><span id="line-1862"></span><span class="hs-comment">-- When the second argument has at most one element, we can be a little</span><span>
</span><span id="line-1863"></span><span class="hs-comment">-- clever.</span><span>
</span><span id="line-1864"></span><span id="cartesianProduct"><span class="annot"><span class="annottext">cartesianProduct :: forall a b. Set a -&gt; Set b -&gt; Set (a, b)
</span><a href="Data.Set.Internal.html#cartesianProduct"><span class="hs-identifier hs-var hs-var">cartesianProduct</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679158787"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158787"><span class="hs-identifier hs-var">_as</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set (a, b)
forall a. Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1865"></span><span class="annot"><a href="Data.Set.Internal.html#cartesianProduct"><span class="hs-identifier hs-var">cartesianProduct</span></a></span><span> </span><span id="local-6989586621679158786"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158786"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679158785"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679158785"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (a, b)) -&gt; Set a -&gt; Set (a, b)
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b -&gt; (a, b)) -&gt; b -&gt; a -&gt; (a, b)
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679158785"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158786"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-1866"></span><span class="annot"><a href="Data.Set.Internal.html#cartesianProduct"><span class="hs-identifier hs-var">cartesianProduct</span></a></span><span> </span><span id="local-6989586621679158784"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158784"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621679158783"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679158783"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1867"></span><span>  </span><span class="annot"><span class="annottext">MergeSet (a, b) -&gt; Set (a, b)
forall a. MergeSet a -&gt; Set a
</span><a href="Data.Set.Internal.html#getMergeSet"><span class="hs-identifier hs-var hs-var">getMergeSet</span></a></span><span> </span><span class="annot"><span class="annottext">(MergeSet (a, b) -&gt; Set (a, b)) -&gt; MergeSet (a, b) -&gt; Set (a, b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; MergeSet (a, b)) -&gt; Set a -&gt; MergeSet (a, b)
forall (t :: * -&gt; *) m a.
(Foldable t, Monoid m) =&gt;
(a -&gt; m) -&gt; t a -&gt; m
</span><a href="../../base/src/Data.Foldable.html#foldMap"><span class="hs-identifier hs-var">foldMap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679158781"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158781"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Set (a, b) -&gt; MergeSet (a, b)
forall a. Set a -&gt; MergeSet a
</span><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-var">MergeSet</span></a></span><span> </span><span class="annot"><span class="annottext">(Set (a, b) -&gt; MergeSet (a, b)) -&gt; Set (a, b) -&gt; MergeSet (a, b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; (a, b)) -&gt; Set b -&gt; Set (a, b)
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158781"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679158783"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158784"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-1868"></span><span>
</span><span id="line-1869"></span><span class="hs-comment">-- A version of Set with peculiar Semigroup and Monoid instances.</span><span>
</span><span id="line-1870"></span><span class="hs-comment">-- The result of xs &lt;&gt; ys will only be a valid set if the greatest</span><span>
</span><span id="line-1871"></span><span class="hs-comment">-- element of xs is strictly less than the least element of ys.</span><span>
</span><span id="line-1872"></span><span class="hs-comment">-- This is used to define cartesianProduct.</span><span>
</span><span id="line-1873"></span><span class="hs-keyword">newtype</span><span> </span><span id="MergeSet"><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-var">MergeSet</span></a></span></span><span> </span><span id="local-6989586621679160331"><span class="annot"><a href="#local-6989586621679160331"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="MergeSet"><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-var">MergeSet</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="getMergeSet"><span class="annot"><span class="annottext">forall a. MergeSet a -&gt; Set a
</span><a href="Data.Set.Internal.html#getMergeSet"><span class="hs-identifier hs-var hs-var">getMergeSet</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160331"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-cpp">

#if (MIN_VERSION_base(4,9,0))
</span><span id="local-6989586621679160329"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679158775"><span id="local-6989586621679158777"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-type">MergeSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160329"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1877"></span><span>  </span><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-type">MergeSet</span></a></span><span> </span><span id="local-6989586621679158774"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158774"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679158773"><span class="annot"><span class="annottext">&lt;&gt; :: MergeSet a -&gt; MergeSet a -&gt; MergeSet a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-type">MergeSet</span></a></span><span> </span><span id="local-6989586621679158772"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158772"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; MergeSet a
forall a. Set a -&gt; MergeSet a
</span><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-var">MergeSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Set a -&gt; Set a
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158774"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158772"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1880"></span><span id="local-6989586621679160332"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679158766"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-type">MergeSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160332"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1881"></span><span>  </span><span id="local-6989586621679158765"><span class="annot"><span class="annottext">mempty :: MergeSet a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; MergeSet a
forall a. Set a -&gt; MergeSet a
</span><a href="Data.Set.Internal.html#MergeSet"><span class="hs-identifier hs-var">MergeSet</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
forall a. Set a
</span><a href="Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-cpp">

#if (MIN_VERSION_base(4,9,0))
</span><span>  </span><span id="local-6989586621679158763"><span class="annot"><span class="annottext">mappend :: MergeSet a -&gt; MergeSet a -&gt; MergeSet a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MergeSet a -&gt; MergeSet a -&gt; MergeSet a
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(&lt;&gt;)</span></a></span></span><span class="hs-cpp">
#else
</span><span>  </span><span class="hs-identifier">mappend</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">MergeSet</span><span> </span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">MergeSet</span><span> </span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">MergeSet</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">merge</span><span> </span><span class="hs-identifier">xs</span><span> </span><span class="hs-identifier">ys</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1889"></span><span class="hs-comment">-- | Calculate the disjoint union of two sets.</span><span>
</span><span id="line-1890"></span><span class="hs-comment">--</span><span>
</span><span id="line-1891"></span><span class="hs-comment">-- @ disjointUnion xs ys = map Left xs ``union`` map Right ys @</span><span>
</span><span id="line-1892"></span><span class="hs-comment">--</span><span>
</span><span id="line-1893"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-1894"></span><span class="hs-comment">--</span><span>
</span><span id="line-1895"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1896"></span><span class="hs-comment">-- disjointUnion (fromList [1,2]) (fromList [&quot;hi&quot;, &quot;bye&quot;]) =</span><span>
</span><span id="line-1897"></span><span class="hs-comment">--   fromList [Left 1, Left 2, Right &quot;hi&quot;, Right &quot;bye&quot;]</span><span>
</span><span id="line-1898"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1899"></span><span class="hs-comment">--</span><span>
</span><span id="line-1900"></span><span class="hs-comment">-- @since 0.5.11</span><span>
</span><span id="line-1901"></span><span id="local-6989586621679160327"><span id="local-6989586621679160328"><span class="annot"><a href="Data.Set.Internal.html#disjointUnion"><span class="hs-identifier hs-type">disjointUnion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160328"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160327"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160328"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160327"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-1902"></span><span id="disjointUnion"><span class="annot"><span class="annottext">disjointUnion :: forall a b. Set a -&gt; Set b -&gt; Set (Either a b)
</span><a href="Data.Set.Internal.html#disjointUnion"><span class="hs-identifier hs-var hs-var">disjointUnion</span></a></span></span><span> </span><span id="local-6989586621679158762"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158762"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span id="local-6989586621679158761"><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679158761"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set (Either a b) -&gt; Set (Either a b) -&gt; Set (Either a b)
forall a. Set a -&gt; Set a -&gt; Set a
</span><a href="Data.Set.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Either a b) -&gt; Set a -&gt; Set (Either a b)
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either a b
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158762"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b -&gt; Either a b) -&gt; Set b -&gt; Set (Either a b)
forall a b. (a -&gt; b) -&gt; Set a -&gt; Set b
</span><a href="Data.Set.Internal.html#mapMonotonic"><span class="hs-identifier hs-var">mapMonotonic</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; Either a b
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">Set b
</span><a href="#local-6989586621679158761"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1903"></span><span>
</span><span id="line-1904"></span><span class="hs-comment">{--------------------------------------------------------------------
  Debugging
--------------------------------------------------------------------}</span><span>
</span><span id="line-1907"></span><span class="hs-comment">-- | /O(n)/. Show the tree that implements the set. The tree is shown</span><span>
</span><span id="line-1908"></span><span class="hs-comment">-- in a compressed, hanging format.</span><span>
</span><span id="line-1909"></span><span id="local-6989586621679158760"><span class="annot"><a href="Data.Set.Internal.html#showTree"><span class="hs-identifier hs-type">showTree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158760"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158760"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-1910"></span><span id="showTree"><span class="annot"><span class="annottext">showTree :: forall a. Show a =&gt; Set a -&gt; [Char]
</span><a href="Data.Set.Internal.html#showTree"><span class="hs-identifier hs-var hs-var">showTree</span></a></span></span><span> </span><span id="local-6989586621679158757"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158757"><span class="hs-identifier hs-var">s</span></a></span></span><span>
</span><span id="line-1911"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Set a -&gt; [Char]
forall a. Show a =&gt; Bool -&gt; Bool -&gt; Set a -&gt; [Char]
</span><a href="Data.Set.Internal.html#showTreeWith"><span class="hs-identifier hs-var">showTreeWith</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158757"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1912"></span><span>
</span><span id="line-1913"></span><span>
</span><span id="line-1914"></span><span class="hs-comment">{- | /O(n)/. The expression (@showTreeWith hang wide map@) shows
 the tree that implements the set. If @hang@ is
 @True@, a /hanging/ tree is shown otherwise a rotated tree is shown. If
 @wide@ is 'True', an extra wide version is shown.

&gt; Set&gt; putStrLn $ showTreeWith True False $ fromDistinctAscList [1..5]
&gt; 4
&gt; +--2
&gt; |  +--1
&gt; |  +--3
&gt; +--5
&gt;
&gt; Set&gt; putStrLn $ showTreeWith True True $ fromDistinctAscList [1..5]
&gt; 4
&gt; |
&gt; +--2
&gt; |  |
&gt; |  +--1
&gt; |  |
&gt; |  +--3
&gt; |
&gt; +--5
&gt;
&gt; Set&gt; putStrLn $ showTreeWith False True $ fromDistinctAscList [1..5]
&gt; +--5
&gt; |
&gt; 4
&gt; |
&gt; |  +--3
&gt; |  |
&gt; +--2
&gt;    |
&gt;    +--1

-}</span><span>
</span><span id="line-1949"></span><span id="local-6989586621679160321"><span class="annot"><a href="Data.Set.Internal.html#showTreeWith"><span class="hs-identifier hs-type">showTreeWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160321"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160321"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-1950"></span><span id="showTreeWith"><span class="annot"><span class="annottext">showTreeWith :: forall a. Show a =&gt; Bool -&gt; Bool -&gt; Set a -&gt; [Char]
</span><a href="Data.Set.Internal.html#showTreeWith"><span class="hs-identifier hs-var hs-var">showTreeWith</span></a></span></span><span> </span><span id="local-6989586621679158753"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158753"><span class="hs-identifier hs-var">hang</span></a></span></span><span> </span><span id="local-6989586621679158752"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158752"><span class="hs-identifier hs-var">wide</span></a></span></span><span> </span><span id="local-6989586621679158751"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158751"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1951"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158753"><span class="hs-identifier hs-var">hang</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTreeHang"><span class="hs-identifier hs-var">showsTreeHang</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158752"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158751"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1952"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTree"><span class="hs-identifier hs-var">showsTree</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158752"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158751"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1953"></span><span>
</span><span id="line-1954"></span><span id="local-6989586621679160318"><span class="annot"><a href="Data.Set.Internal.html#showsTree"><span class="hs-identifier hs-type">showsTree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160318"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160318"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span></span><span>
</span><span id="line-1955"></span><span id="showsTree"><span class="annot"><span class="annottext">showsTree :: forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTree"><span class="hs-identifier hs-var hs-var">showsTree</span></a></span></span><span> </span><span id="local-6989586621679158743"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158743"><span class="hs-identifier hs-var">wide</span></a></span></span><span> </span><span id="local-6989586621679158742"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span></span><span> </span><span id="local-6989586621679158741"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158741"><span class="hs-identifier hs-var">rbars</span></a></span></span><span> </span><span id="local-6989586621679158740"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158740"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1956"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158740"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1957"></span><span>      </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;|\n&quot;</span></span><span>
</span><span id="line-1958"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158738"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158738"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1959"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158738"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\n&quot;</span></span><span>
</span><span id="line-1960"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158737"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158737"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158736"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158736"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158735"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158735"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1961"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTree"><span class="hs-identifier hs-var">showsTree</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158743"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withBar"><span class="hs-identifier hs-var">withBar</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158741"><span class="hs-identifier hs-var">rbars</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withEmpty"><span class="hs-identifier hs-var">withEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158741"><span class="hs-identifier hs-var">rbars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158735"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1962"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-var">showWide</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158743"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158741"><span class="hs-identifier hs-var">rbars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1963"></span><span>             </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158737"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\n&quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1964"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-var">showWide</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158743"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1965"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTree"><span class="hs-identifier hs-var">showsTree</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158743"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withEmpty"><span class="hs-identifier hs-var">withEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withBar"><span class="hs-identifier hs-var">withBar</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158742"><span class="hs-identifier hs-var">lbars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158736"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1966"></span><span>
</span><span id="line-1967"></span><span id="local-6989586621679160319"><span class="annot"><a href="Data.Set.Internal.html#showsTreeHang"><span class="hs-identifier hs-type">showsTreeHang</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160319"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160319"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span></span><span>
</span><span id="line-1968"></span><span id="showsTreeHang"><span class="annot"><span class="annottext">showsTreeHang :: forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTreeHang"><span class="hs-identifier hs-var hs-var">showsTreeHang</span></a></span></span><span> </span><span id="local-6989586621679158726"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158726"><span class="hs-identifier hs-var">wide</span></a></span></span><span> </span><span id="local-6989586621679158725"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span></span><span> </span><span id="local-6989586621679158724"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158724"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1969"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158724"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1970"></span><span>      </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;|\n&quot;</span></span><span>
</span><span id="line-1971"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158723"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158723"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1972"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158723"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\n&quot;</span></span><span>
</span><span id="line-1973"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158722"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158722"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158721"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158721"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158720"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158720"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-1974"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var">showsBars</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
forall a. Show a =&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158722"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\n&quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1975"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-var">showWide</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158726"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1976"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTreeHang"><span class="hs-identifier hs-var">showsTreeHang</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158726"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withBar"><span class="hs-identifier hs-var">withBar</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158721"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1977"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-var">showWide</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158726"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-1978"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
forall a. Show a =&gt; Bool -&gt; [[Char]] -&gt; Set a -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsTreeHang"><span class="hs-identifier hs-var">showsTreeHang</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158726"><span class="hs-identifier hs-var">wide</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withEmpty"><span class="hs-identifier hs-var">withEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158725"><span class="hs-identifier hs-var">bars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158720"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1979"></span><span>
</span><span id="line-1980"></span><span class="annot"><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-type">showWide</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1981"></span><span id="showWide"><span class="annot"><span class="annottext">showWide :: Bool -&gt; [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showWide"><span class="hs-identifier hs-var hs-var">showWide</span></a></span></span><span> </span><span id="local-6989586621679158719"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158719"><span class="hs-identifier hs-var">wide</span></a></span></span><span> </span><span id="local-6989586621679158718"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158718"><span class="hs-identifier hs-var">bars</span></a></span></span><span>
</span><span id="line-1982"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679158719"><span class="hs-identifier hs-var">wide</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [Char]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158718"><span class="hs-identifier hs-var">bars</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;|\n&quot;</span></span><span>
</span><span id="line-1983"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShowS
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1984"></span><span>
</span><span id="line-1985"></span><span class="annot"><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-type">showsBars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span>
</span><span id="line-1986"></span><span id="showsBars"><span class="annot"><span class="annottext">showsBars :: [[Char]] -&gt; ShowS
</span><a href="Data.Set.Internal.html#showsBars"><span class="hs-identifier hs-var hs-var">showsBars</span></a></span></span><span> </span><span id="local-6989586621679158714"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158714"><span class="hs-identifier hs-var">bars</span></a></span></span><span>
</span><span id="line-1987"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158714"><span class="hs-identifier hs-var">bars</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1988"></span><span>      </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ShowS
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1989"></span><span>      </span><span class="annot"><span class="annottext">[[Char]]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [Char]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier hs-var">tail</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158714"><span class="hs-identifier hs-var">bars</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="Data.Set.Internal.html#node"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-1990"></span><span>
</span><span id="line-1991"></span><span class="annot"><a href="Data.Set.Internal.html#node"><span class="hs-identifier hs-type">node</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1992"></span><span id="node"><span class="annot"><span class="annottext">node :: [Char]
</span><a href="Data.Set.Internal.html#node"><span class="hs-identifier hs-var hs-var">node</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;+--&quot;</span></span><span>
</span><span id="line-1993"></span><span>
</span><span id="line-1994"></span><span class="annot"><a href="Data.Set.Internal.html#withBar"><span class="hs-identifier hs-type">withBar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#withEmpty"><span class="hs-identifier hs-type">withEmpty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1995"></span><span id="withBar"><span class="annot"><span class="annottext">withBar :: [[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withBar"><span class="hs-identifier hs-var hs-var">withBar</span></a></span></span><span> </span><span id="local-6989586621679158711"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158711"><span class="hs-identifier hs-var">bars</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;|  &quot;</span></span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; [[Char]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158711"><span class="hs-identifier hs-var">bars</span></a></span><span>
</span><span id="line-1996"></span><span id="withEmpty"><span class="annot"><span class="annottext">withEmpty :: [[Char]] -&gt; [[Char]]
</span><a href="Data.Set.Internal.html#withEmpty"><span class="hs-identifier hs-var hs-var">withEmpty</span></a></span></span><span> </span><span id="local-6989586621679158710"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158710"><span class="hs-identifier hs-var">bars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;   &quot;</span></span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; [[Char]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679158710"><span class="hs-identifier hs-var">bars</span></a></span><span>
</span><span id="line-1997"></span><span>
</span><span id="line-1998"></span><span class="hs-comment">{--------------------------------------------------------------------
  Assertions
--------------------------------------------------------------------}</span><span>
</span><span id="line-2001"></span><span class="hs-comment">-- | /O(n)/. Test if the internal set structure is valid.</span><span>
</span><span id="line-2002"></span><span id="local-6989586621679160312"><span class="annot"><a href="Data.Set.Internal.html#valid"><span class="hs-identifier hs-type">valid</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679160312"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679160312"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-2003"></span><span id="valid"><span class="annot"><span class="annottext">valid :: forall a. Ord a =&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#valid"><span class="hs-identifier hs-var hs-var">valid</span></a></span></span><span> </span><span id="local-6989586621679158707"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158707"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-2004"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier hs-var">balanced</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158707"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Ord a =&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#ordered"><span class="hs-identifier hs-var">ordered</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158707"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#validsize"><span class="hs-identifier hs-var">validsize</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158707"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-2005"></span><span>
</span><span id="line-2006"></span><span id="local-6989586621679158704"><span class="annot"><a href="Data.Set.Internal.html#ordered"><span class="hs-identifier hs-type">ordered</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679158704"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158704"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-2007"></span><span id="ordered"><span class="annot"><span class="annottext">ordered :: forall a. Ord a =&gt; Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#ordered"><span class="hs-identifier hs-var hs-var">ordered</span></a></span></span><span> </span><span id="local-6989586621679158701"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158701"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-2008"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; Set a -&gt; Bool
forall {a}. Ord a =&gt; (a -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679158700"><span class="hs-identifier hs-var">bounded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; a -&gt; Bool
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; a -&gt; Bool
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158701"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-2009"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2010"></span><span>    </span><span id="local-6989586621679158700"><span class="annot"><span class="annottext">bounded :: (a -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679158700"><span class="hs-identifier hs-var hs-var">bounded</span></a></span></span><span> </span><span id="local-6989586621679158695"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158695"><span class="hs-identifier hs-var">lo</span></a></span></span><span> </span><span id="local-6989586621679158694"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158694"><span class="hs-identifier hs-var">hi</span></a></span></span><span> </span><span id="local-6989586621679158693"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158693"><span class="hs-identifier hs-var">t'</span></a></span></span><span>
</span><span id="line-2011"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158693"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2012"></span><span>          </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2013"></span><span>          </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158692"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158692"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679158691"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158691"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158690"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158690"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158695"><span class="hs-identifier hs-var">lo</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158692"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158694"><span class="hs-identifier hs-var">hi</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158692"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679158700"><span class="hs-identifier hs-var">bounded</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158695"><span class="hs-identifier hs-var">lo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158692"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158691"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; Set a -&gt; Bool
</span><a href="#local-6989586621679158700"><span class="hs-identifier hs-var">bounded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679158692"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679158694"><span class="hs-identifier hs-var">hi</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158690"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-2014"></span><span>
</span><span id="line-2015"></span><span id="local-6989586621679158689"><span class="annot"><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier hs-type">balanced</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158689"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-2016"></span><span id="balanced"><span class="annot"><span class="annottext">balanced :: forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier hs-var hs-var">balanced</span></a></span></span><span> </span><span id="local-6989586621679158681"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158681"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-2017"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158681"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2018"></span><span>      </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2019"></span><span>      </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158680"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158680"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158679"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158679"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158680"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158679"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158680"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158679"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158679"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Set.Internal.html#delta"><span class="hs-identifier hs-var">delta</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158680"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-2020"></span><span>                     </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier hs-var">balanced</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158680"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Set a -&gt; Bool
forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#balanced"><span class="hs-identifier hs-var">balanced</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158679"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-2021"></span><span>
</span><span id="line-2022"></span><span id="local-6989586621679158678"><span class="annot"><a href="Data.Set.Internal.html#validsize"><span class="hs-identifier hs-type">validsize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679158678"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-2023"></span><span id="validsize"><span class="annot"><span class="annottext">validsize :: forall a. Set a -&gt; Bool
</span><a href="Data.Set.Internal.html#validsize"><span class="hs-identifier hs-var hs-var">validsize</span></a></span></span><span> </span><span id="local-6989586621679158674"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158674"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-2024"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Maybe Int
forall {a}. Set a -&gt; Maybe Int
</span><a href="#local-6989586621679158673"><span class="hs-identifier hs-var">realsize</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158674"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int -&gt; Maybe Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Int
forall a. Set a -&gt; Int
</span><a href="Data.Set.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158674"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-2025"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2026"></span><span>    </span><span id="local-6989586621679158673"><span class="annot"><span class="annottext">realsize :: Set a -&gt; Maybe Int
</span><a href="#local-6989586621679158673"><span class="hs-identifier hs-var hs-var">realsize</span></a></span></span><span> </span><span id="local-6989586621679158667"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158667"><span class="hs-identifier hs-var">t'</span></a></span></span><span>
</span><span id="line-2027"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158667"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2028"></span><span>          </span><span class="annot"><span class="annottext">Set a
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2029"></span><span>          </span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679158666"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158666"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679158665"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158665"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679158664"><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158664"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set a -&gt; Maybe Int
</span><a href="#local-6989586621679158673"><span class="hs-identifier hs-var">realsize</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158665"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Set a -&gt; Maybe Int
</span><a href="#local-6989586621679158673"><span class="hs-identifier hs-var">realsize</span></a></span><span> </span><span class="annot"><span class="annottext">Set a
</span><a href="#local-6989586621679158664"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2030"></span><span>                            </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679158663"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158663"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679158662"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158662"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158663"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158662"><span class="hs-identifier hs-var">m</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158666"><span class="hs-identifier hs-var">sz</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679158666"><span class="hs-identifier hs-var">sz</span></a></span><span>
</span><span id="line-2031"></span><span>                            </span><span class="annot"><span class="annottext">(Maybe Int, Maybe Int)
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-2032"></span></pre></body></html>